Where do you put your scripts?

Sarah sarahr at genesearch.com.au
Thu May 2 18:51:01 EDT 2002


This is an excellent question and especially relevant to people who come 
from an older programming environment. My advice is to put the scripts 
as low in the hierarchy as you can. This makes finding & debugging 
problems much easier. It is possible to put every function & handler in 
the stack script and then just have the objects call those handlers, but 
this makes tracking down errors extremely difficult.

Here are some examples showing what I do:
If you have an object with a unique purpose, put all the script in the 
object.
If you have a group (say radio buttons), and they all do the same thing 
but with a parameter based on which button is hilighted, put the script 
in the group.
If you have a series of non-grouped objects which all do the same sort 
of thing, put that script in the card script.
If you have general utility functions and startup/shutdown stuff, put 
them in the stack script.
If you have multiple stacks and routines that they all need, put the 
scripts in the mainStack.

This is the scheme I use but I haven't go into using frontScripts or 
backScripts yet. Perhaps someone else could advise on this.

Generally, start by writing in the object itself, but if you find that 
another object needs that code, move that script (or a sub-section of 
it) to the next level up the hierarchy i.e. object -> group -> card -> 
stack.

Cheers,
Sarah


On Friday, May 3, 2002, at 02:29  am, Dar Scott wrote:

> I don't mean for this to be a how-to question.  I mean for it to be a 
> style or code-management question.
>
> If I work alone (not too alone in this case--I visit use-revolution) I 
> easily develop strange habits and when someone looks over shoulder, I 
> hear things like, "WHAT are you doing?" or "Why are you doing that the 
> hard way?"
>
> I realize people on this list have lots of experience and lots of good 
> ideas.  So I wonder...
>
> Where do you put your scripts?
>
> (What kind and how much goes into controls, groups, card, mainStack, 
> inserts, library stack and whatever I neglected to mention?)
>
> Thanks!
>
> Dar Scott
> Near the northern Rio Grande
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list