.NET

Reply
Active Contributor
Punisher
Posts: 27
Registered: ‎08-02-2006
Message 1 of 9 (120 Views)

Hungarian Notation

120 Views, 8 Replies
08-24-2006 05:35 AM
I read in a MS C# book, that Hungarian notation was not to be used any further, and the C++ people would just hate it. I still see C# code samples from Autodesk and others in Hungarian.

Is it in fact not to be used industry wide, or is this just the Author's preferences
Valued Contributor
smcclure
Posts: 60
Registered: ‎06-08-2006
Message 2 of 9 (120 Views)

Re: Hungarian Notation

08-24-2006 07:58 AM in reply to: Punisher
It is true - Hungarian notation is being dropped. The preference is now CamelCase and variations on it (pascalCase I believe is the other name).

The .NET Coding Guidelines - Guidelines for Names is available at:
http://msdn2.microsoft.com/en-us/library/ms229002.aspx
*clintonG
Message 3 of 9 (120 Views)

Re: Hungarian Notation

08-24-2006 07:19 PM in reply to: Punisher
As it turns out it really doesn't matter although the convention you have
been referred to has its merits as it does result in quality code. Too many
Microsoft employees are primadonnas and do not even
follow their own guidelines let alone cooperate with language conventions
agreed by general consensus. This can be observed at MSDN and MSDN2 which
for the most part provide high quality documentation supporting coding
conventions. Then observe there is a break-away group who have
forked the development platform by using the asp.net website to start doing
their own thing using Atlas to subvert the conventions that so many spent so
much personal time arguing and eventually agreeing to adopt.

The point is then Too many of them are
undisciplined rank hypocrits. By all means take what is useful from what you
have been referred to as a guideline but do what works for you -- noting if
and when you are working with others -- its best to discipline yourself as
you may likely have when adopting CAD Layer Guidelines and other standards.
That is, be cooperative and adopt the convention your peers have
established. Be a pro.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W



wrote in message news:5306092@discussion.autodesk.com...
It is true - Hungarian notation is being dropped. The preference is now
CamelCase and variations on it (pascalCase I believe is the other name).

The .NET Coding Guidelines - Guidelines for Names is available at:
http://msdn2.microsoft.com/en-us/library/ms229002.aspx Message was edited by: Discussion Admin
Active Contributor
Punisher
Posts: 27
Registered: ‎08-02-2006
Message 4 of 9 (120 Views)

Re: Hungarian Notation

08-28-2006 05:41 AM in reply to: Punisher
Thanks for the information
John
Distinguished Contributor
ChrisArps
Posts: 311
Registered: ‎07-29-2004
Message 5 of 9 (120 Views)

Re: Hungarian Notation

09-01-2006 12:04 PM in reply to: Punisher
I have only found one place where I still use "hungarian" notation. When I define UI elements like combo boxes or text boxes I prefer to use prefixes so it is easier to work with the code.

Example :

dim deltaX as double = 0.0 ' No Hungarian needed
dim numbertOfUsers as integer = 5 ' None here

dim txtUserName as TextBox ' all textboxes start with txt
dim cmbState as ComboBox ' combos with cmb

Chris Arps
*Paul Richardson
Message 6 of 9 (120 Views)

Re: Hungarian Notation

09-01-2006 12:10 PM in reply to: Punisher
.net also holds onto the COM "I" for interfaces.
wrote in message news:5315980@discussion.autodesk.com...
I have only found one place where I still use "hungarian" notation. When I
define UI elements like combo boxes or text boxes I prefer to use prefixes
so it is easier to work with the code.

Example :

dim deltaX as double = 0.0 ' No Hungarian needed
dim numbertOfUsers as integer = 5 ' None here

dim txtUserName as TextBox ' all textboxes start with txt
dim cmbState as ComboBox ' combos with cmb

Chris Arps
Active Contributor
Punisher
Posts: 27
Registered: ‎08-02-2006
Message 7 of 9 (120 Views)

Re: Hungarian Notation

09-01-2006 12:18 PM in reply to: Punisher
I thought it was hoaky when I started using it, but now I wish they were not stopping the use of it. It is much easier to deal with variables, especially moving data back and forth between strings, text fields, db arrays, doubles, and which UI field is this. I am beginning to interact with the "outside world", and don't want to use an outmoded style.
Valued Contributor
kidcoach
Posts: 70
Registered: ‎05-02-2003
Message 8 of 9 (120 Views)

Re: Hungarian Notation

09-13-2006 02:21 PM in reply to: Punisher
I think it depends on the IDE you're coding in. If I was writing C# code in notepad without tooltips and intellisense, I'd be lost without HungarianNotation. In the VS.NET IDE, however, it makes sense to use camelCase, with all the clues the IDE gives you as to what the variable type is.

I've also adopted camelCase everywhere except UI elements. (txtFirstName, cboState, etc)
*Maksim Sestic
Message 9 of 9 (120 Views)

Re: Hungarian Notation

09-15-2006 07:14 AM in reply to: Punisher
I'm suggesting sticking to FxCop's specs.

http://www.gotdotnet.com/team/FxCop/

Regards,
Maksim Sestic

wrote in message news:5305766@discussion.autodesk.com...
I read in a MS C# book, that Hungarian notation was not to be used any
further, and the C++ people would just hate it. I still see C# code samples
from Autodesk and others in Hungarian.

Is it in fact not to be used industry wide, or is this just the Author's
preferences
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.