Making the move...
sarah.reichelt at gmail.com
Mon Mar 20 06:29:54 CST 2006
On 3/20/06, Geoff Canyon <gcanyon at inspiredlogic.com> wrote:
> Out of curiosity, do you have an example handy of a long handler that
> you think makes more sense to keep together than to break up? Or one
> that you think can't be broken up without significant effort to do it?
> When you think of a long handler, do you generally think of it as
> having a single identifiable task, or do you think of it as being
> several tasks performed in sequence in one handler?
> Obviously it's possible that you simply think in bigger chunks ;-)
In my experience, it's probably due to never passing values by
reference. If I am working on a routine that generates multiple
variables, then acts on them, it is easier to keep it all together
than to try and transfer more than one variable back & forth between
handlers & functions.
A separate function is great if it only has to return one variable,
but as soon as it acts on more than one, I find it easier to leave
that code as part of the main handler.
Of course, if a segment of code is used by more than one handler, it's
worth the effort to split it out, but otherwise, I'm not too fussed
about keeping handlers small. Good commenting can overcome any
problems interpreting it later :-)
More information about the use-livecode