I haven't seen a sane programmer use either Apps or Systems Hungarian. While Systems Hungarian is plain ridiculous, one might argue that Apps Hungarian helps [morons] choosing consistent variable names; but in my opinion, there are far better alternatives, the most prominent one being common sense.
Consider the following two code snippets to naively determine the length of a string:
And here's the second one:Code:culCount = 0; for(ichIndex=0; rgchText[ichIndex] != '\0'; ichIndex++) culCount++; return culCount;
The second one is much shorter and not the least bit difficult to understand. Note that you can easily guess the types of all variables and furthermore that the variable i serves two different purposes: it's an array index and a counter. This isn't even expressible in Apps Hungarian.Code:for(i=0; a[i] != '\0'; i++); return i;
Apart from readability, there are some more disadvantages when using Hungarian notation:
- the type of a variable may change several times during the lifetime of a project; but now changing the type involves adapting every occurrence of that variable.
- a less-than-gifted programmer (the sole reason for Hungarian notation) may choose the wrong prefixes, confusing everyone who has to read his code.
- ...
Greets,
Philip