[thelist] Re: Naming Conventions (was Documentation)

jay.blanchard at thermon.com jay.blanchard at thermon.com
Mon Feb 11 10:54:05 CST 2002

 > strUN (string)
 > intX  (integer)
 > lngX  (long)

What you are looking at here is something called Hungarian Notation. It is
a way to not only define variables, but to also define what the variable
is. Also, you needn't use such short variable names...

strFirstName (a string containing the first name)
intNumberPeople (an integer indicating the number of people)

...so on and so forth...

http://www.umr.edu/~cpp/common/hungarian.html is a list of notations that
are in heavy use among procedural coders.


<tip type="documentation" author="J Blanchard">
Clearly naming declared variables, whether the variable is global or local,
leads to "self-explanatory" code...in essence self-documenting code. The
use of vague variables, where the variable name reveals nothing about its
type or what it does can cause hours of headaches during troubleshooting
when something goes wrong. The use of vague variables can cause you many
additional hours of documentation because you have to explain what each
variable is (i.e. "x" is a variable equal to the number of people at the
location.) Hungarian Notation is widely accepted and can be used in many
procedural and scripting languages such as JAVA, PHP, PERL, VBScript, ASP, etc.

More information about the thelist mailing list