Best Practices in Rev development

Devin Asay devin_asay at byu.edu
Tue Jun 19 14:34:06 EDT 2007


On Jun 19, 2007, at 12:16 PM, Ken Ray wrote:

> On Tue, 19 Jun 2007 10:18:26 -0600, Devin Asay wrote:
>
>> Are they helpful?
>
> Very nice, Devin!
>
>> Could some of them inadvertently cause problems down the road?
>> Have I left something important out?
>
> Well, I don't know if this is *important*, but it works for me - it's
> along the lines of "Use meaningful names": I name all buttons exactly
> the same as their labels, without any spaces or punctuation, so for
> example a checkbox that says "Use meaningful names" would be named
> "UseMeaningfulNames" - this makes it unnecessary to look up the  
> name of
> a button in order to address it in a script. The only times I break
> this habit is where conventional abbreviations are things that come to
> "top of mind" as an alternative (for example, a button that says
> "Download Now" would be named "DLNow" because "DL" is a very common
> alternative for "Download").

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.

How about just turning on the global IDE property,  
showObjectNameAsTooltipOnHover. ;-)
>
> Similarly I name all fields based on the label that precedes it (if
> there is one) using the same approach. So a label field that says
> "First Name:" and has a text entry field next to it would have the
> entry field named "FirstName".

Interestingly, I tend to do the same, but it was never a conscious  
decision to do it. I guess this qualifies as an "intuitive"  
technique. :-)

> I generally don't give names to label
> fields, but if I do need to, I follow the rule above and add "lbl" in
> front of it (so the label field I describe above would be called
> "lblFirstName" if I needed to address it).

Yep, I do the same thing with label fields.

Regards,

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list