• 0

[.NET] Hungarian Convention


Do you follow the Hungarian convention with .NET code?  

8 members have voted

  1. 1. Do you follow the Hungarian convention with .NET code?

    • Yes - for every object, every time
      0
    • Yes - but only with objects I access programmatically
      0
    • Yes - but I use something other than .NET
      0
    • No - .NET's type safety is enough for me
      4
    • No - other reason
      4


Question

I'm curious to see how many .NET developers still use the Hungarian convention. I'm taking a VB.NET class (easy credits :p) and my instructor requires us to use Hungarian names on every object, no matter if we use it in code or not. Being used to C# and not seeing any Hungarian names since I started .NET, I have to stop myself in the middle of coding just to add the "int" prefix to all my integers, "str" to all my strings, "frm" to all my forms (only one), etc. Now, it was my understanding that the built in type safety of .NET meant that none of these prefixes were necessary and that the extra code was unnecessary. I mean, look at all the built in classes. None of them have Hungarian style names, except interfaces.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

I find it unnecessary in .NET partly because of the type safety it inherently has, but also because I use Visual Studio.net, and I can see the type of a variable any time I want.

I follow MSDN's Naming Guidelines as much as possible, although I've been known to use Pascal case for parameter names.. bad programmer!

Link to comment
Share on other sites

  • 0
I'm hungarian but i don't get it....what is with hungarian language and programming language??

584727279[/snapback]

Heh. You got it all wrong. Although I don't know the history of the Hungarian notation, I'm assuming it was invisioned by a Hungarian programmer.

Hungarian is basically like this. If you want to define a string variable, the name would be like this:

strCustomerName

or an integer variable

intCustomerAge

It was used with older programming languages to make sure the right variables were being used for the right methods. However, .NET is smart enough to know what you can and can't use in a method.

Link to comment
Share on other sites

  • 0
Heh. You got it all wrong. Although I don't know the history of the Hungarian notation, I'm assuming it was invisioned by a Hungarian programmer.

Hungarian is basically like this. If you want to define a string variable, the name would be like this:

strCustomerName

or an integer variable

intCustomerAge

It was used with older programming languages to make sure the right variables were being used for the right methods. However, .NET is smart enough to know what you can and can't use in a method.

584727304[/snapback]

LOL :rofl: now i understand it :) Whatever i still prefer speaking hungarian in IRL more, than in programming :p j/k

Link to comment
Share on other sites

  • 0

I mostly use C#.NET but I still use hungarian notations (only on form objects) just because its easier for me in the property window(VS.NET and 2005 beta) or document structure tab if I'm trying to select an "invisible" control to just goto "btnWhatever" instead of trying to remember what the name for it was. Or if i need to apply a property to all buttons not to have to seach though each of the zillion controls for the name of it but just have all the buttons lined up. But for coding variables, strings, etc I only use hungarian notation if its a variable shared throughout the whole class, not just inside a function (forgot the name) just so I can instantly remember what type that variable is.

Link to comment
Share on other sites

  • 0

Does the hungarian notation apply to every single type, or just primitive types? The only instance in which i append a prefix to the actual name of the Object is probably on controls only, like txtBox, frmMain, btnClick, etc... I think applying it for controls is a good way to do things, because when you have a well formed convention of using btn's for Button controls, technically when Intellisense comes in handy, looking for it in a long list would really save so much time, as all the Button controls will be grouped under the btn's.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.