Best Practices in Rev development
Devin Asay
devin_asay at byu.edu
Wed Jun 20 10:28:37 EDT 2007
On Jun 19, 2007, at 10:00 PM, Kay C Lan wrote:
> On 6/20/07, Devin Asay <devin_asay at byu.edu> wrote:
>>
>> I like this technique, but there are lots of times when I've created
>> a button, given it a name and label, then down the road decided that
>> the label isn't exactly right and needs to be changed for clarity's
>> sake. Often in these cases I have already referred to the button many
>> times in handlers, so it becomes a chore to rename the button. So you
>> would lose one of the main advantages of the capability of having the
>> name and the label be different.
>
>
> Not so, and is in fact one of the reasons I like following the
> pattern of
> ensuring the label and the name are the same (which typically are
> identical
> to the MySQL column name I'm retrieving the data from). Should I
> decide down
> the track that the name, either in MySQL or Rev needs to change to
> something
> better, in Rev you simply open up the IDE Find and Replace (not the in
> script Search). In most cases, because the original name is self
> explanatory
> it is highly likely that it is unique so a global Find and Replace
> is OK,
> but if you're way into a project and you discover you've just
> created your
> 15th "Next" button and figure maybe some buttons should be named/
> labeled
> 'Next Card', 'Next Page', 'Next Chapter', 'Next Week', etc etc, the
> Find and
> Replace does a great (but slow) job of identifying the actual
> control or a
> reference to it in a script.
>
> Yes, if you had 15 Next buttons with 10s of references to each of
> them in
> scripts, changing them at a later date would be a pain, which of
> course is
> the reason for the 'best practice' to intentionally avoid the
> generic 'Next'
> and think of a 'descriptive' name; is it Next Job, Next Pay, Next
> Dance, etc
> etc. If you can be descriptive enough to avoid repetition then
> changing
Well argued, Kay. (Yes, I do know about Find and Replace, but it is
often overridden by the lazyDeveloper flag. ;-) )
In fact, based on your argument I may add a new best practice item:
As much as possible, keep object names unique within a stack. It will
make finding and changing references to object names in scripts
easier, should it become necessary.
Regards,
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list