Skydiver
Staff member
It's not a big enough sampling, but I've noticed a few recent C# posts both here and in DIC where the posters have been using the Hungarian naming convention in their code. And it's not just the leading underscore prefix to denote member variables, but rather the type defining prefixes like dbl, str, bool, lst, dic, etc.
Personally, this drives me up the wall because if people are going to use Hungarian, they should use Hungarian the way it was originally meant to be used. n for integer, not int. rg for array, not are. s for string, not str. d for double not dbl. f for float, not flt. And fully spelled out typenames for everything else. Eg. combobox for a ComboBox, not cmb. Checkbox, not chk. datetime, not dt.
Anyway, does anyone know why Hungarian notation seems to be icoming back into fashion? Is there a trending tutorial or library that is pushing this? Or is is VB6 programmers who had come up with that bastardized Hungarian moving on from VB.NET and going into C# who are bringing along their old naming conventions?
Hungarian notation is not really needed for C# (and VB.NET) because of the nature of the IDEs and text editors we use with the language. The editor and debugger can now show us the type of the variable without resorting to using Hungarian. And it's not like we do paper code reviews anymore. People do code reviews with their text editors. And the correct modern style of writing code discourages huge files, and huge methods. So anything declared will either be on the same screen, or at worse, just a few pages away.
The reasons why Hungarian was invented by Charles Simonyi was to help denote type information to aid in debugging and reasoning with code. The MS Windows org adopted it because it was really helpful, specially when doing low level debugging in the kernel when all you would have at times is just the symbol name. The MS Office team adopted the idea, but instead of is my the prefixes to denote the low level type, they used it to denote semantic usage of the variable.
Personally, this drives me up the wall because if people are going to use Hungarian, they should use Hungarian the way it was originally meant to be used. n for integer, not int. rg for array, not are. s for string, not str. d for double not dbl. f for float, not flt. And fully spelled out typenames for everything else. Eg. combobox for a ComboBox, not cmb. Checkbox, not chk. datetime, not dt.
Anyway, does anyone know why Hungarian notation seems to be icoming back into fashion? Is there a trending tutorial or library that is pushing this? Or is is VB6 programmers who had come up with that bastardized Hungarian moving on from VB.NET and going into C# who are bringing along their old naming conventions?
Hungarian notation is not really needed for C# (and VB.NET) because of the nature of the IDEs and text editors we use with the language. The editor and debugger can now show us the type of the variable without resorting to using Hungarian. And it's not like we do paper code reviews anymore. People do code reviews with their text editors. And the correct modern style of writing code discourages huge files, and huge methods. So anything declared will either be on the same screen, or at worse, just a few pages away.
The reasons why Hungarian was invented by Charles Simonyi was to help denote type information to aid in debugging and reasoning with code. The MS Windows org adopted it because it was really helpful, specially when doing low level debugging in the kernel when all you would have at times is just the symbol name. The MS Office team adopted the idea, but instead of is my the prefixes to denote the low level type, they used it to denote semantic usage of the variable.