Why Chained Behaviors May Be A Bad Idea

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Sep 13 11:27:11 EDT 2016


mwieder wrote:

    Hopefully that's a typo and not a circular reference.
    So
    
        A
        |
    B----C
            |
            D
    
    Is perfectly reasonable. B has access to A, C has access to A, D has access
    to C and A. But not B.
    
    To use a textbook example,
    if A=shape, B=circle, C=triangle, and D=right triangle
    you wouldn't expect (or want) a right triangle to inherit anything from
    circles, but any changes to triangle should be accessible from right
    triangles. You might want all circles to be blue and all triangles to be
    red. Those would be handlers in the B and C scripts. You could then have all
    right triangles be black (in the D script), and that wouldn't affect other
    types of triangles.

BR: yes that was a typo: thanks for this "textbook example"  very helpful… 

gives me the courage to try using it… as it could solve a number of challenges where re-use of code *should* be the best practice but exactly how to accomplish that without polluting a global API (backscript) with all kinds of non-global, extraneous handlers/functions (and mysterious since you lose context)… --one just needs to adopt a smart naming convention so that in the PB, you know what is going on by look at the behavior/scripts file names… 
    
    Thanks for your patient responses

BR




More information about the use-livecode mailing list