Chained Behaviors

Richard Gaskin ambassador at fourthworld.com
Fri Jul 12 13:58:29 EDT 2013


Peter Haworth wrote:
> Has anyone got any real world examples of the benefits of the new chained
> behaviors feature?
>
> I just read the latest newsletter article about them and while I understand
> the concept,  I didn't see benefit in the example scenario over a single
> behavior with some common logic and a switch statement to handle the logic
> specific to each "sprite".

It obviates the switch statement.

We could take this question one step back and ask why we'd want 
behaviors at all, when we could just use frontScripts with switch 
statements instead.

But that thought experiment (hopefully) makes the case for behaviors clear.

Nested behaviors simply extend the value of such a mechanism, at long 
last giving xTalk one of the most valuable aspects of OOP:  subclasses.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys




More information about the use-livecode mailing list