Nick Hodges and Jim Cooper got into a bit of an argument about Hungarian Notation. This all started with Nick's praise of Joel's article on Apps Hungarian and Making Wrong Code look Wrong.
I think they both agree, but they are caught up in the semantics. They both say it is more important that an identifier indicate its purpose and what it contains, then the type of what it contains. The both also seem to dislike cryptic variable names.
Jim is referring to where in Joel's article he says
"every variable was prefixed with a lower case tag"
And then Joel goes on to use abbreviations in all his examples. Thus tag must mean abbreviation.
If you read Charles Simonyi's original article you will see a few examples where he uses whole words (like rowFirst and rowLast) but the specific tables he provides at the bottom use cryptic one, two or at most three letter abbreviations.
Also if you look at WHY it is called Hungarian Notation. It was given this name because the inclusion of these cryptic letters at the beginning of the words made them no longer look like English, but instead like Hungarian.
So what Nick is advocating is to use the principles of the Apps portion of Apps Hungarian, but not the Hungarian portion. The Hungarian portion is to use cryptic 1 to 3 letter prefixes on your identifiers. The Apps portion is to describe your identifiers based on the kind of data they hold (row, unsafe, counter, etc.) Which is different from the Systems portion of Systems Hungarian which is to describe your identifiers with the type of data they hold.
To summarize the differences:
- Apps means to indicate kind or purpose
- Systems means to indicate the type
- Hungarian means to indicate the above with an abbreviated tag which results in the variable looking more like it was written in Hungarian then in English.
Jim just hates the cryptic 1 to 3 letter prefixes, and I don't think anyone blames him. I agree with all his points, and it isn't just because he has such a cool name.
2 comments:
"Also if you look at WHY it is called Hungarian Notation."
It was because Charles Simonyi *is* Hungarian, not because the words "look" Hungarian!
Read the second paragraph in the "note from Dr. GUI"
It came to be known as "Hungarian notation" because the prefixes make the variable names look a bit as though they're written in some non-English language and because Simonyi is originally from Hungary.
I was putting emphasis on the "non-English" part, but you are correct. It didn't look like English, so it must be Hungarian since that is where he was from.
Post a Comment