Joel Spolsky wrote an interesting article which had a brief history of Hungarian notation, amongst other things. Cedric Beust’s picked it up and made the claim that We are all Hungarian Notation users. I’m not buying it.
I’ve got two disagreements with Hungarian notation.
The “information” encoded in the variable name is often irrelevant. This is the “dark side” of Hungarian notation that Joel points out. What possible meaning does, oh, having an ‘I’ at the front of a type name, give me, other than I can’t instantiate it? What about other types I can’t instantiate (such as classes with no visible constructor, or abstract classes)?
Condensing information into a couple of letters at the front makes it hard to work out what is meant. Why bother? Why not just spell out the information to get a meaningful variable name? After all, IDEs expand variables for us easily enough, so the extra typing isn’t an issue.
Another “disagreement” is that you should use the type system of the language to encode type information. This is only a pseudo-disagreement, because that’s a little awkward to do in C (you would keep needing to pull the primitive components of the type back out again). But guess what? I don’t write C code any more, and I’ll be damned if I want to write C code in Java.
Joel’s first example of the use of Hungarian notation is ‘rw’ and ‘col’ prefixes for, well, rows and columns. So what’s wrong with ‘row’ or ‘column’ prefixes? Is it still Hungarian notation if I spell the word out? I don’t think so. What if I use ‘Row’ and ‘Column’ types, and toss away the prefix?
Cedric’s first example (the use of ‘i’, ‘j, and ‘k’ for loop counters) isn’t an example of Hungarian notation. It’s an example of a coding idiom. ‘cnt1’, ‘cnt2’, ‘cnt3’ is Hungarian (and also an idiom, as well). ‘counter1’, ‘counter2’, ‘counter3’ work just as well, but is no longer Hungarian. Using a for-each loop is a different idiom that removes the entire problem, and it’s what I exclusively use since I moved up to Java 5.
Cedric’s second example, ‘the widget’, ‘the label of the widget’, ‘the callback of the widget’ is even easier to address. Give the widget a meaningful name. Then call ‘widget.getLabel()’ or ‘widget.getCallback()’ (where widget, obviously, gets replaced by the meaningful name). Works like a charm.
So, Cedric, no I don’t use Hungarian notation. Yes, I use meaningful variable names. Yes, in some occasions, I use idiomatic abbreviations, such as ‘i’, ‘j’, ‘k’. But this isn’t Hungarian in either sense put forward by Joel.
 If you’re an anti-IDE zealot, that’s your problem. Work out how to get your editor to expand variable names for you, by using a language-aware mode.