So, the ex-Microsoft developer who invented Hungarian notation is going into outer space. So, it appears, he is receiving a punishment befitting his crimes against humanity—exile from the planet.
For those who are unfamiliar and also not willing to skim an entire Wikipedia article, here's an example of Hungarian notation: lpszBar. If you had a variable named lpszBar, you could conclude that it is named Bar, and a long pointer to a null-terminated (z) string. Personally, I would vastly prefer to name it Bar.
I've gotta agree with you here. To declare a variable by declaring its type and THEN having to embed the type itself into the name is lunacy. It's a duplication of effort for virtually no benefit.
AND, what if I change the type of a variable from:
Now I have to rename every instance of btnCancel just because I've changed the class.
Any development environment worth its salt will let you just mouseover the variable name to get its type. No reason to do extra work.
I also agree that Hungarian notation is an evil relic of the days of MFC *shudder*. However, naming your variable "Bar" would not fit with the .NET Framework naming conventions! Clearly, the name of "bar" would be ideal.
Sounds about as horrible as Visual Basic to me. :-P
Local variables aren't covered by the general .NET Framework naming conventions. Under C# convention, you should use "bar" for a local variable, but under VB convention, you should use "Bar" instead.
See Steven's post for how I feel about Visual Basic. Having to use it's wackily verbose syntax and weird case insensitivity for Design Studio has just about broken me. :-P
Post a Comment