<Rant topic='Hungarian'>Damn I get mad about stuff!

Some things get me really fired up.

Not your typical high school debating issues (abortion, euthenasia, religion, ho hum?) -- but Hungarian naming standards. Now that's a fiercesome topic! Full of emotion! A political minefield!

Oh I've tried to code without Hungarian. I've followed the new standards. But it's a crock! A marketing foible!

Getting rid of Hungarian is just a terrible piece of 'Fashion' that will later be looked back on with regret.

'Well we've got .Net now, so we'd better make all of our code look minimalist, clean and non-technical...'

'Everything's an object, you know, like Java, so let's do what sun does'

[Rant continues, with comparisons...]

You may feel that for an API (a public API that you are going to foist onto other people) will *look* better if you avoid hungarian. That's kind of true.

But in such a case the details of your API are largely a marketing exercise and have little to do with 'Maintainability.'

But for real code, the guts of your code, the sort of code you write every day and work with every day, nothing can beat Hungarian.

Arguments I've seen against Hungarian

  1. "Hungarian makes code harder to read. for example: m_dblPrice vs Price."

    No, it isn't harder to read, it's more informative and easier to understand.
    "Price" alone tells you much much less than "m_dblPrice".
    The reader's digest condensed version of "Slaughterhouse 5" is a quicker read too. But that doesn't make it better.
    To a seasoned developer, "m_dblPrice" is easier to read than just "Price". Your mind is not distracted by questions like, "hang on, is this the pricing object? or the price parameter? or the local static price variable? or the module level... let me just hover over it, or right click on it and then... oh!" You get the idea.

  2. "With Intellisense you can find out the type and scope of a variable more easily than previously."

    Not as easily as you can with Hungarian, baby!
    You can only find out one variable at a time
    Without Hungarian, you have to actively seek that information out.
    Intellisense doesn't help if the code is printed out, or pasted into an email, or provided on a web page, or being viewed in any other way. (You probably read a lot of code outside of the IDE, just like I do.)

  3. "It takes longer to write "m_dblPrice" than it does to write 'Price'"

    Yes but it's quicker to use and maintain, because you can find it faster.
    Roland Weigelt has excellent pictures that demonstrate this.

  4. "In Hungarian, if you change the type of the variable then you have to change the name. What a mess!"

    This is a very good point, and I concede it utterly.
    However, in Whidbey, refactoring support promises to be a lot better.
    You will be able to rename a variable with ease.

  5. In Hungarian, if someone puts in the wrong prefix, it will mislead you.

    True enough. But FX-Cop can gobble up problems of this sort. You needn't lose any sleep over it.

The main reason I've seen for ditching hungarian is:

"But this is the new way."

Come here and say that! I dare you! You'll feel the stinging wrath of my sarcastic wit! You will be sorry, dunderhead.



My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.