Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > MCSD > Hungarian notation in .NET

Reply
Thread Tools

Hungarian notation in .NET

 
 
Kael V. Dowdy
Guest
Posts: n/a
 
      10-13-2003
I'm curious...

I've been wondering why I haven't seen any Hungarian notation used in
variable/object names when looking at programming examples in any .NET
training literature.

I've always had hammered in my head to use two or three letter
prefixes such as txtFirstName, intCounter, cnEmployees, for a text
box, integer data type, and connection object, etc... for VB coding.
I think there are "standards" for different programming
languages/environments, and I've tended to follow them, especially
since other coders may have to maintain your code, and it's a lot
easier to identify what variables/objects actually are if you prefix
them IMHO.

Also, my MCT for VB 6 went to a .NET MOC training course, and he said
the MOC didn't have any prefixes/mnemonics in any of the coding
examples. Is this something that .NET is getting away from???

Kael
 
Reply With Quote
 
 
 
 
Kline Sphere
Guest
Posts: n/a
 
      10-13-2003
You are free to define any coding standards and practices you wish,
the importance points to keep in mind are consistency and relevance.

My on view is that Hungarian notation is rather pointless within
modern object oriented practices given that a 'name' should be self
describing and relate back to the actual type. Even in procedural C, I
found some really funny examples of Hungarian notation usage,e.g. how
would you represent an array of functions pointer (which accept an
array of longs) which return and array of functions pointers which
return an array of vectors?

>I'm curious...
>
>I've been wondering why I haven't seen any Hungarian notation used in
>variable/object names when looking at programming examples in any .NET
>training literature.
>
>I've always had hammered in my head to use two or three letter
>prefixes such as txtFirstName, intCounter, cnEmployees, for a text
>box, integer data type, and connection object, etc... for VB coding.
>I think there are "standards" for different programming
>languages/environments, and I've tended to follow them, especially
>since other coders may have to maintain your code, and it's a lot
>easier to identify what variables/objects actually are if you prefix
>them IMHO.
>
>Also, my MCT for VB 6 went to a .NET MOC training course, and he said
>the MOC didn't have any prefixes/mnemonics in any of the coding
>examples. Is this something that .NET is getting away from???


 
Reply With Quote
 
 
 
 
Maria
Guest
Posts: n/a
 
      10-13-2003
>I haven't seen any Hungarian notation
....
>Is this something that .NET is getting away from???


Yes, with .Net they have dropped the hungarian notation.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpgenref/html/cpconparameternamingguidelines.asp

Naming conventions are a pain to enforce but a real time
saver for the people who need to maintain the code later
on. There is a nice customisable utility called FxCop that
inspects your .net assemblies for for conformance to the
Microsoft .NET Framework Design Guidelines:
http://www.gotdotnet.com/team/fxcop/


>-----Original Message-----
>You are free to define any coding standards and practices

you wish,
>the importance points to keep in mind are consistency and

relevance.
>
>My on view is that Hungarian notation is rather pointless

within
>modern object oriented practices given that a 'name'

should be self
>describing and relate back to the actual type. Even in

procedural C, I
>found some really funny examples of Hungarian notation

usage,e.g. how
>would you represent an array of functions pointer (which

accept an
>array of longs) which return and array of functions

pointers which
>return an array of vectors?
>
>>I'm curious...
>>
>>I've been wondering why I haven't seen any Hungarian

notation used in
>>variable/object names when looking at programming

examples in any .NET
>>training literature.
>>
>>I've always had hammered in my head to use two or three

letter
>>prefixes such as txtFirstName, intCounter, cnEmployees,

for a text
>>box, integer data type, and connection object, etc...

for VB coding.
>>I think there are "standards" for different programming
>>languages/environments, and I've tended to follow them,

especially
>>since other coders may have to maintain your code, and

it's a lot
>>easier to identify what variables/objects actually are

if you prefix
>>them IMHO.
>>
>>Also, my MCT for VB 6 went to a .NET MOC training

course, and he said
>>the MOC didn't have any prefixes/mnemonics in any of the

coding
>>examples. Is this something that .NET is getting away

from???
>
>.
>

 
Reply With Quote
 
Kael V. Dowdy
Guest
Posts: n/a
 
      10-13-2003
> >-----Original Message-----
> >You are free to define any coding standards and practices

> you wish,
> >the importance points to keep in mind are consistency and

> relevance.


Very true...

> >
> >My on view is that Hungarian notation is rather pointless

> within
> >modern object oriented practices given that a 'name'

> should be self
> >describing and relate back to the actual type. Even in


Yes, you are right...I feel too that names should be self subscribing
(something that the .NET base class library namespaces did pretty
well, WTG MS!)

> procedural C, I
> >found some really funny examples of Hungarian notation

> usage,e.g. how
> >would you represent an array of functions pointer (which

> accept an
> >array of longs) which return and array of functions

> pointers which
> >return an array of vectors?
> >


That'd be a really funny and long name, huh?

"Maria" <(E-Mail Removed)> wrote in message news:<07de01c3915f$083d94c0$(E-Mail Removed)>...
> >I haven't seen any Hungarian notation

> ...
> >Is this something that .NET is getting away from???

>
> Yes, with .Net they have dropped the hungarian notation.
>
> http://msdn.microsoft.com/library/default.asp?
> url=/library/en-
> us/cpgenref/html/cpconparameternamingguidelines.asp


I checked this out, gotta spend some more time perusing through this
section of MSDN.

>
> Naming conventions are a pain to enforce but a real time
> saver for the people who need to maintain the code later
> on. There is a nice customisable utility called FxCop that
> inspects your .net assemblies for for conformance to the
> Microsoft .NET Framework Design Guidelines:
> http://www.gotdotnet.com/team/fxcop/


FxCop looks like a really cool too...gotta check it out!

> >
> >>I'm curious...
> >>
> >>I've been wondering why I haven't seen any Hungarian

> notation used in
> >>variable/object names when looking at programming

> examples in any .NET
> >>training literature.
> >>
> >>I've always had hammered in my head to use two or three

> letter
> >>prefixes such as txtFirstName, intCounter, cnEmployees,

> for a text
> >>box, integer data type, and connection object, etc...

> for VB coding.
> >>I think there are "standards" for different programming
> >>languages/environments, and I've tended to follow them,

> especially
> >>since other coders may have to maintain your code, and

> it's a lot
> >>easier to identify what variables/objects actually are

> if you prefix
> >>them IMHO.
> >>
> >>Also, my MCT for VB 6 went to a .NET MOC training

> course, and he said
> >>the MOC didn't have any prefixes/mnemonics in any of the

> coding
> >>examples. Is this something that .NET is getting away

> from???
> >
> >.
> >

 
Reply With Quote
 
Jaime
Guest
Posts: n/a
 
      10-13-2003
It's used for the (name) property.
>-----Original Message-----
>I'm curious...
>
>I've been wondering why I haven't seen any Hungarian

notation used in
>variable/object names when looking at programming

examples in any .NET
>training literature.
>
>I've always had hammered in my head to use two or three

letter
>prefixes such as txtFirstName, intCounter, cnEmployees,

for a text
>box, integer data type, and connection object, etc... for

VB coding.
>I think there are "standards" for different programming
>languages/environments, and I've tended to follow them,

especially
>since other coders may have to maintain your code, and

it's a lot
>easier to identify what variables/objects actually are if

you prefix
>them IMHO.
>
>Also, my MCT for VB 6 went to a .NET MOC training course,

and he said
>the MOC didn't have any prefixes/mnemonics in any of the

coding
>examples. Is this something that .NET is getting away

from???
>
>Kael
>.
>

 
Reply With Quote
 
Jay Walters
Guest
Posts: n/a
 
      10-15-2003
Another reason why - is because everything is strongly
typed.. generic objects and type-casting are less
frequent.

Most people will use mObjectName and cObjectName to
represent class level objects, functions and property
instances just represent what you're doing.

dim consultRows as DataRow()




>-----Original Message-----
>I'm curious...
>
>I've been wondering why I haven't seen any Hungarian

notation used in
>variable/object names when looking at programming

examples in any .NET
>training literature.
>
>I've always had hammered in my head to use two or three

letter
>prefixes such as txtFirstName, intCounter, cnEmployees,

for a text
>box, integer data type, and connection object, etc...

for VB coding.
>I think there are "standards" for different programming
>languages/environments, and I've tended to follow them,

especially
>since other coders may have to maintain your code, and

it's a lot
>easier to identify what variables/objects actually are

if you prefix
>them IMHO.
>
>Also, my MCT for VB 6 went to a .NET MOC training

course, and he said
>the MOC didn't have any prefixes/mnemonics in any of the

coding
>examples. Is this something that .NET is getting away

from???
>
>Kael
>.
>

 
Reply With Quote
 
Simon Smith
Guest
Posts: n/a
 
      10-15-2003
On Tue, 14 Oct 2003 20:16:08 -0700 in article
<2b00f01c392ca$ad3ad930$(E-Mail Removed)> in
microsoft.public.cert.exam.mcsd , "Jay Walters"
<(E-Mail Removed)> wrote:

>Another reason why - is because everything is strongly
>typed.. generic objects and type-casting are less
>frequent.
>
>Most people will use mObjectName and cObjectName to
>represent class level objects, functions and property
>instances just represent what you're doing.
>
>dim consultRows as DataRow()
>


I'm not sure you're right about mObjectName and cObjectName. Our shop
follows the MS recommendations for .NET and thus we don't use them at
all. (On a side note, I never did myself.)


--
Simon
simon dot smith at snowvalley dot com
"Insomnia is a small price to pay for the stuff you read on UseNet"
 
Reply With Quote
 
Jay Walters
Guest
Posts: n/a
 
      10-15-2003
That's the thing, this isn't about right or wrong, it's
all preference.

The Microsoft way seems to be regular Camel Case and no
prefixes, (even though VS control names default to pascal
case).

But many people find it nicer to use a prefix for class
fields. Using 'm' and 'c' for example allows intellisense
to group all of your objects. Most of the MSFT people I
know use just a '_' --> string _connString;

Some people are also fanatical about using Base. and Me.

The most important thing in all of this is to be
consistant within your projects.

For more information about namimg guidelines:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpgenref/html/cpconpropertynamingguidelines.asp





>
>I'm not sure you're right about mObjectName and

cObjectName. Our shop
>follows the MS recommendations for .NET and thus we

don't use them at
>all. (On a side note, I never did myself.)
>
>
>--
>Simon
>simon dot smith at snowvalley dot com
>"Insomnia is a small price to pay for the stuff you read

on UseNet"
>.
>

 
Reply With Quote
 
Kline Sphere
Guest
Posts: n/a
 
      10-15-2003
On Wed, 15 Oct 2003 11:44:56 -0700, "Jay Walters"
<(E-Mail Removed)> wrote:

>That's the thing, this isn't about right or wrong, it's
>all preference.


.... And consistence within an organization.

>Most of the MSFT people I
>know use just a '_' --> string _connString;


Been a common approach taken to indicate 'private' members for as long
as I can remember.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hungarian Notation Question Immortal Nephi C++ 1 05-26-2009 10:00 PM
Hungarian Notation inhahe Python 12 05-30-2008 08:31 AM
Hungarian notation dom.k.black@googlemail.com C++ 42 03-29-2008 05:36 PM
Hungarian Notation Vs. Pascal Notation? Grey Squirrel ASP .Net 6 03-21-2007 09:42 AM
Why NOT hungarian notation? darrel ASP .Net 24 12-09-2006 03:11 PM



Advertisments