Death to Hungarian Notation
For those of you who are not familiar with Hungarian Notation, may I suggest you never familiarize yourself with it, and if you are familiar with it, do you still use it?
After spending a few hours extending some LotusScript libraries written by an external vendor, my hatred for Hungarian Notation has resurfaced. Besides the dislike for what appears to me to be an insufficient way to denote an objects type, but is also rarely used properly!
In the case of the code I am sifting through, they used “c” for strings, “n” for Longs, Doubles, and Integers, and “b” for Boolean. This is a perfect case of someone who read about Hungarian Notation, but never bothered to read the entire chapter. So what is left is someone like me who sees a “c” and thinks the object is an item count, not a string, or trys to compare a double to a long.
So what do you use? For me the notation depends on the language, but I always use a three character notation. In LotusScript, I use:
str - string
int - integer
dbl - double
lng - long
lst - list
doc - NotesDocument
col - NotesDocumentCollection
var - Variant
etc….
When I work in .NET, I use similiar notation but I may also use something like:
ddl - DropDownList
txt - Text Field
grd - GridView
lit - Literal
etc…
I know it is not perfect, but it seems to work the best when you have multiple developers using the same code libraries. So what is your favorite?
July 13th, 2006 at 7:44 pm
You need to find better external vendors.
July 17th, 2006 at 1:15 pm
With our recent track-record of picking bad vendors, I am afraid to pick new ones.
August 1st, 2006 at 9:30 am
I used to use Hungarian notation, pretty much in the form you demonstrate here. And then one day I just decided to stop… I still use quite descriptive variable and object names, I just can’t be doing with notation, especially as code tends to change in scope and form — it’s all too simple for someone to update an underlying datatype without bothering to update the variable reference.
So, I juest rely on the IDE and strong typing to get me through ;o)
August 1st, 2006 at 12:50 pm
Amen Ben!
When I worked for IBM I used to have some customers who employed super-elitist technology snobs who looked down on anyone who did not use proper notation. One customer in particular would not sign off on hours billed unless all code was reviewed and accepted by said snobs.
But if you have to use it, I still think you need more than one character.
September 23rd, 2006 at 2:04 pm
[…] They do not cop a condescending tone if a coworker does not use some obscure object naming convention. […]