Hacker News new | ask | show | jobs
by SenorWilson 4939 days ago
I'm not sure what's up with all the hate for reverse hungarian notation, but I personally think it is helpful when writing C/C++.
1 comments

I think it is crazy. Especially today, when IDEs can show you the declaration of a variable or method while hovering over it, there is no need to encode the type of a variable into the name. Variable names need to be sensible to humans, the compiler doesn't do checking on them anyway: it's all too common for the type prefixes to become misleading when a program has been refactored and they don't match up anymore.
It is crazy if you misuse Hungarian Notation like 99% of the people out there

For the 1000th time

"there is no need to encode the type of a variable into the name"

It's not the data type (int, char, etc), it's the nature of the thing being counted!

Number of apples, height, distance, etc

But of course when saying "type" most people would think it's the data type when it's not

I'm not sure what you're referring to, but in all instances of Hungarian notation I've seen (especially in Windows programs) it was the data type (pointer to char, 8 bit int, 32 bit int etc) encoded and not "the nature of the thing".

I agree that adding the "nature of the thing being counted" makes sense, but then you don't have to call it Hungarian notation anymore, "number_of_apples" is just a sensible variable name...

Joel Spolsky wrote a good summary about the Hungarian notation, and how it got corrupted within Microsoft:

http://www.joelonsoftware.com/articles/Wrong.html

Thanks for the explanation. The original idea was pretty good. But I've only, ever, seen the corrupted variant in the wild. And coding standards that enforce it. Hence my annoyance.
Yeah, Hungarian Notation may have flowered in the Councils of Elrond, the mere sound of which would give men Knowledge, Wisdom and inflation-adjusted semi-annual raises, but out here on the edge of Mordor it's been horribly twisted into something only an Orc could love and look upon. If an Orc could love.