Kill those warts!

Rory is one of my favorite bloggers.  Earlier this week he posted Die, Hungarian notation... Just *die*, which sentiment I agree with wholeheartedly.  Jim Hyslop and Herb Sutter's (three years earlier) article Hungarian wartHogs is also a great read.

I never understood why people are so enamored of Hungarian notation.  My view has always been that if you use meaningful names type information is meaningless.  Further, if you have so many variables running around that you have to embed type information in their names to keep track of what's going on, you bloody well need to do some serious refactoring!  Not to mention that I don't want to have to go through all my code changing member names just because a variable's type changed from int to long.

Hungarian notation, of course, is one of those topics over which jihads are regularly fought.  Now you know which side I'll be on when the next one starts.  <g/>

Comments (3)

  1. I never thought Hungarian notiation went far enough. You should prefix all variables with the datatype, the module, the date coded, the coder who made it, a short description, and a long description. Example:

    int int_Customer_20040302_alex_CustID_IntegerRepresentingTheCustomersID;


    int CustomerID;

    I think it’s pretty obvious which one is easier to read.

  2. Rory says:

    "Not to mention that I don’t want to have to go through all my code changing member names just because a variable’s type changed from int to long."

    That’s one that bugs me, too, but it gets sicker.

    What about people who change the variable’s type but *not* the notation?

    *That’s* pretty screwed up.

  3. Nicole says:

    I use a kind of notation.

    As I mainly do awk in a limited, I have no need for strict notations but I do use a_ as an indicator for arrays, "i,j,k,l,m,n" as counter, Input / Outputfilenames have a e_/d_ prefix (eingabe = input, d = dateiname = output).

    There are some other examples but I can say: I do not use it but was inspired to think of a system of my own, which is connected to the notation – and helped a lot in it.

Skip to main content