Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming convention, the keynote at the
Message
From
11/04/2009 17:08:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Naming convention, the keynote at the
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01394369
Message ID:
01394369
Views:
151
[this started as a footnote to message #1394363, but it didn't feel right to pour this on Evelyn just because I happened to be replying to her at the moment. Could be anybody.]

"Command1" is a very bad name. I can't imagine a button where .click() contains of "thisform.do1()" - one is not a verb, not an action, so not knowing what your button is doing, other than it needs to show/hide other buttons, I can't conclude anything from its name.

{classname}1 is not a name, it's a placeholder that Fox supplies (because you can't edit a control which doesn't have a name - so there's one), a sign that your control is waiting to be named for real. You should know what your control is doing, and give it an appropriate name. If you can't, you're either too clumsy with words, or you have realized that you don't exactly know what is this control doing. If it's not clear to you, how will you know what it should do? How will you test it and/or debug it? How would you know whether it's doing right, if you don't know what it's doing?

Same goes for method names, except that VFP isn't trying to help us there, as there are no base methods to instantiate from, no new names, so any custom method should be named after what it's doing (Naomi, links to wherever we left off with this last time - just verb vs VerbOfAction+NounAsObjectOfAction - please, if you can remember; this winter, I think) and VFP won't help us there.

Which is good in a way. Because it forces us to give [meaningful] names to, at least, custom methods. Well, scratch meaningful, I've seen too many of them named ambiguously. And then, what's unambiguous to you, may confuse everyone else. Learning to predict what may be ambiguous is not easy and probably may cost you a lot of time and nerve, but just try to keep it in some corner of your mind when you're naming an entity. My usual check is to see whether any abbr. I used in it can be misconstrued. Misconstr.? OK, but not much shorter. Miscons.? Well, maybe. Misc.? Ah, no, that sounds like "miscellaneous". Compare with... comp.? How many words begin with "comp"? How many with "con[s]"? (about 2000)

Now everybody rant on bad cases of wrong/awful/sufferable/bad naming you met, and/or pour your disagreement over what I said above.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Next
Reply
Map
View

Click here to load this message in the networking platform