living and learning (Re: RunRev vs RealBasic (Richard Gaskin))

Richard Gaskin ambassador at fourthworld.com
Wed Jan 19 20:00:41 EST 2005


Dan Shafer wrote:
> 
> On Jan 19, 2005, at 12:34 PM, Richard Gaskin wrote:
> 
>> What got me started using groups instead of cards was referencing 
>> objects in scripts:  While designing WebMerge 2.0 I kept moving 
>> controls from one tab to another until I got myself clear on what the 
>> program's flow should be.  During those changes I'd have to change 
>> every script reference to every object to include the different card 
>> name.
>>
>> With groups I have all 180+ controls on one card, so I can say:
>>
>>    get the hilite of btn "idxTemplateOption"
>>
>> ...and it doesn't matter to the code which group that's part of.
> 
> Unless (as is the case in one of my apps), you have multiple groups with 
> controls that have the same name. This facilitates making the code more 
> generic/abstract and allowing me to place scripts at a higher level, but 
> has the downside that I have to track the current group and do things like:
> 
> get the hilite of btn "idxTemplateOption" of group curGroup
> 
> WHen you forget to to that, stuff breaks in ways that are all but 
> invisible.

But that's where my curmudgeonly habits have their rare moment of 
practical applicability:

The name idxTemplateOption is already a unique identifier.  The "idx" 
prefix tells me which part of the program it relates to, and the rest 
describes what it does.  I can move the object anywhere in the card, 
from group to group, and always address it by name alone.

Of course it's less readable from an English standpoint, but fortunately 
code is skimmed more often than it's read, and funky prefixes tend to 
stand out visually from the more English-like words native to Transcript.

For example, skim this sentence with theWindows and the Windows and see 
if the former stands out as much as tWindows.

Of course someone with your experience already has whatever funky naming 
tricks help you skim, but newcomers might find some of these helpful:

<http://www.fourthworld.com/embassy/articles/scriptstyle.html>

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the Use-livecode mailing list