Best Practices in Rev development

Kay C Lan lan.kc.macmail at gmail.com
Wed Jun 20 00:00:35 EDT 2007


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
names/labels/references down the track is relatively straight forward.

[Tangent]
Anyone using the Free version of Galaxy should be aware that it doesn't come
with global Find and Replace so you have to use the Rev IDE Find and
Replace. Unfortunately, due to the way Galaxy interacts with Rev any script
changes you make with the IDE Find and Replace will not be recognised in
Galaxy so when you return to Galaxy to do more scripting all those global
replaces are lost. If you need to do a Find and Replace you need to turn
Free Galaxy off.

This is NOT an issue with the full version of Galaxy which comes with global
Find and Replace.



More information about the use-livecode mailing list