Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming conventions again........
Message
From
28/08/1999 15:55:24
 
 
To
27/08/1999 16:29:01
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00258085
Message ID:
00258856
Views:
14
>>Mike,
>>
>>I didn't ask the entire contents or a copy, I did ask what the main message was.
>>
>>Walter,
>Hi Walter, Mike
>Mike, I'm glad somebody read it. Thanks. Someday when your kids say, "Daddy, why do you put those letters in front of your variable names?", I hope you will be confident of your answer. :-)

I read it to. I'm a member of the "opposing camp" - I agree with Steve Black's reply, Keep Your Effective Naming Conventions (September 1997.)

I use some prefixing (as I've said before, I make some assumptions about the default scoping of variables, and prefix with both a scope and type only when something isn't local) but I do it in a consistent and uniform manner for my own code. When I do work for a client who requires the use of Hungarian notation, I make the swtich (even though it usually means going back and re-reading my own code when I've got it working to make certain that I adhere to their standard) because the most important thing is to make sure that some standard is followed to give the next guy in line a clue. I'm not the one who's going to be most affected (unless a few days happen to go by and I can't remember what something was, and I didn't document things adequately in-line). The prefix gives the observer a quick clue about the expected scope, type and usage that appears in a uniform place in the name.

For me, the biggest payoff isn't reading through a page in the code, it's looking in a Watch Window or the Locals Window in the debugger, and say "Why the #&$)(*& is cSomeRandomValue a DateTime right now?" In these circumstances, I may not have the full page of code and its comments at hand, so the visual clue of a prefix helps me considerably.

Of course, it might be that I spend too much time in the debugger... < g >

>The main message, Walter, was exactly as you posed as you started this thread: Is there a good reason for where we are today regarding naming conventions.

There's a good reason for standards; if Hungarian is widely accepted, I'll use it unless someone gives me a good reason not to do so. Hungarian notation isn't an excuse for a cryptic name! Names can and should be descriptive. While I grew up with variable names i, j, x and y (and foo, bar, mumble, bletch, too) and react automatically to some of them, nCounter is more meaningful than i, and nFileListCounter even more so. Or for the Hungarian-inclined, lnFileListCounter. And for me, any and all of the preceding are better than lnI...

>I hate cryptic names, so I harped on creating English names that conveyed the type whereever possible.

English is unfortunately a horrid language for establishing context and type; this is one reason that the payoff for scoping and typing is large in the narrow view context of reference rather than a global one. You need to read and comprehend the entire name to establish this information from a 'meaningful variable name' rather than having a clue from the form of the name (eg the establishment of gender in Romance languages through the suffix), so the return on investing a few characters in the beginning of a name along with giving the thing a name that has some meaning helps across the board.

I comprehend what's going on in detail in my code based on the meaning of things, but I react based on initial perception, and prefixing provides an easily-perceived cue. A standard provides me the ability to tell someone else what my cues are. A variable name needs to do both things - provide a quick clue as to its intended type and scope, and provide some detail about what it's meant to do on more detailed examination. So prefixing variables consistently and giving them meaningful names seems to be the right way to do things.

>I like polymorphistic names, so I think MS erred by naming things like PageCount, FormCount, ButtonCount. It's a PageFrame! It has a count! The property should be Count. If something has a Name, I call it Name, not CustName. It's in the Customer table, so that's the context.
>Others may gain solace by having prefixes, but I get mine from good naming of variables and the like--not that I always do.
>I freely admit this must be a genetic thing. I just can hardly read the prefixes. They get in my way. But then, I never know whether a b loops to the right or left either.
>Charlie
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform