where to put handlers?

Sadhunathan Nadesan sadhu at castandcrew.com
Tue Feb 5 18:49:36 EST 2008

Deep bows to Sarah, who wrote:

> My general rule is to place each handler or function as low in the
> hierarchy as practical. If a button has a single use, then it contains
> it's own handler.

With true respect, I would like to suggest an alternative approach,
the reverse.  Place handlers as high as posssible, such as in the
stack script.

In the objects at low level, like buttons, just put calls to the handlers.
Make handlers as generic as possible so they may be called with the
requisite parameters.

Reason:  easy to edit a single script with everything in one place,
easy to find what you are looking for, instead of hunting around in
various buttons or other objects with code scattered all around.

Maintenance is the key.

Now, I was not deeply reading into the post so I may have missed
some important thoughts.  If so, apologies in advance.


More information about the Use-livecode mailing list