473,783 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why NOT hungarian notation?

I just discovered that MS recommends that we NOT use hungarian notation with
the .net framework:

http://msdn2.microsoft.com/en-us/library/ms229045.aspx

What are the real cons for using it?

I tend to use it a lot, especially when IDing my controls. For instance the
controls in a contact form I create could be IDed as such:

tbx_firstName
tbx_emailAddres s
ddl_state

I find this really helpful when in codebehind.

is the 'no hungarian' merely a preference MS has, or are there specific cons
to me being stubborn and sticking with it?

-Darrel

--
=============== =============== =============== =============== =====
Win prizes searching google:
http://www.blingo.com/friends?ref=hM...nTqhv-2GE1FNtA
Dec 8 '06
24 2379
Thus wrote Joerg,

Thus wrote Mark,
>"darrel" <no*****@nowher e.comwrote in message
news:eC******* ******@TK2MSFTN GP06.phx.gbl...
>>>>or are there specific cons to me being stubborn and sticking with
it?
>
None whatever.

Ha! Thanks for the feedback, Mark. At least I can find peace with me
knowing that I'm not alone in wanting to stick with it. ;o)
Without doubt the stupidest reason for not using it I've ever come
across was that you might change the underlying datatype (e.g. from
byte to integer) that a variable referred to, so you'd have to go
through your entire code and change it...

Well, my copy of VS.NET has got a find and replace utility...
Unfortunately, changing source code all over the place usually means
going through the entire test cycle of that component *again*, even
though semantically there's no change. Accordingly, changing a
variable name because of a type change is not only stupid but also
expensive, IMNSHO.
Of course this only applies if you miss renaming variables when implementing
the type change or decide to update your type prefixes throughout.

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Dec 9 '06 #21
"Joerg Jooss" <ne********@joe rgjooss.dewrote in message
news:94******** *************** ***@msnews.micr osoft.com...
Unfortunately, changing source code all over the place usually means going
through the entire test cycle of that component *again*, even though
semantically there's no change.
"All over the place..."??? With a properly designed system, this should
hardly ever happen anyway i.e. your database field types, class properties
etc should already be agreed upon before you start writing your first line
of code. If that isn't the case, then that *really* is stupid...
Accordingly, changing a variable name because of a type change is not only
stupid but also expensive, IMNSHO.
Not nearly so stupid and expensive as having to refer constantly to
IntelliSense, or the technical spec, every time you need to know what
datatype a variable or class property is...

Being a jobbing IT consultant, I'm quite often brought in to fix or update a
system where there is no documentation, and I always charge extra if the
code doesn't use Hungarian notation or, at least, *some* sort of notation
because, without it, it will take me proportionately longer to do my work.

E.g. imagine a Customer class with a CustomerID property - what datatype is
CustomerID?
Dec 9 '06 #22
On Sat, 9 Dec 2006 11:02:10 -0000, "Mark Rae" <ma**@markNOSPA Mrae.com>
wrote:
>
E.g. imagine a Customer class with a CustomerID property - what datatype is
CustomerID?
I dunno it might be a value type instead. Once I find out I won't need
to be constantly reminded that CustomerID is a string or an int or
even an object of type CustomerID. I find this ability especially
helpful when working with generics.

The question itself reads as if you are suggesting being consistant
and using hungarian notation in every scope. I agree, if hungarian
notation is to be used at all, it should be used everywhere so all
consumers can receive all the supposed benefits.

public class Customer
{
// public int int_CustomerID {...}
// public string str_CustomerID {...}
public CustomerID custid_Customer ID {...}
public string str_CustomerNam e {...}
...
}

regards
A.G.

Dec 9 '06 #23
"Registered User" <n4***@ix.netco m.comwrote in message
news:o9******** *************** *********@4ax.c om...
>>E.g. imagine a Customer class with a CustomerID property - what datatype
is
CustomerID?
I dunno
Of course you don't...How could you...?
it might be a value type instead.
Instead of what...?
Once I find out I won't need to be constantly reminded that CustomerID is
a
string or an int or even an object of type CustomerID.
LOL! Well, if you have a photographic memory, I certainly don't! Yes, once I
know it's an int or whatever, I'll retain that particular piece of
information for as long as I need to. But next week, next month, next year
when I come to revisit the code in response to a request for change or
whatever, I'll almost certainly have forgotten it again...
I find this ability especially helpful when working with generics.
Me too.
The question itself reads as if you are suggesting being consistant
and using hungarian notation in every scope.
I most certainly am.
I agree, if hungarian notation is to be used at all, it should be used
everywhere so all consumers can receive all the supposed benefits.
I couldn't agree more!
Dec 9 '06 #24
On Sat, 9 Dec 2006 13:28:07 -0000, "Mark Rae" <ma**@markNOSPA Mrae.com>
wrote:
>"Registered User" <n4***@ix.netco m.comwrote in message
news:o9******* *************** **********@4ax. com...
>>>E.g. imagine a Customer class with a CustomerID property - what datatype
is
CustomerID ?
I dunno

Of course you don't...How could you...?
>it might be a value type instead.

Instead of what...?
Instead of a nullable datatype.
>
>Once I find out I won't need to be constantly reminded that CustomerID is
a
string or an int or even an object of type CustomerID.

LOL! Well, if you have a photographic memory, I certainly don't! Yes, once I
know it's an int or whatever, I'll retain that particular piece of
information for as long as I need to. But next week, next month, next year
when I come to revisit the code in response to a request for change or
whatever, I'll almost certainly have forgotten it again...
Myself as well but the time frame can be shorter. It never hurts to
review the code your going to touch. Part of the review is to refresh
the understanding of the existing design and code. The balance is to
consider and understand what changes are required and how those should
be accomplished. If this isn't done the programmer is just hacking on
the code trying to make 'it' (the desired changes) work.
>I find this ability especially helpful when working with generics.

Me too.
It doesn't take much to make CustomerID a generic.
public Customer<Custom erID>
{
public CustomerID CustomerID{...}
...
}
If this isn't riddle then this should be either
public Customer<Custom erID>
{
public int CustomerID{...}
...
}
>The question itself reads as if you are suggesting being consistant
and using hungarian notation in every scope.

I most certainly am.
>I agree, if hungarian notation is to be used at all, it should be used
everywhere so all consumers can receive all the supposed benefits.

I couldn't agree more!
I was trying to be tongue-in-cheek, not foot-in-mouth. My problem with
hungarian notation is it has never been used to describe public
properties that point to hungarian-notated private and protected
members. This inconsistancy and the fact there is no standard makes me
question the value of the whole process especially in this day and
age.

If hungarian notation works for you that is fine and dandy. We can
agree to disagree. Now step away from the computer and take the rest
of the day off. That is what I'm doing.

regards
A.G.
Dec 9 '06 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2138
by: Denny | last post by:
For most of my variable names, I use Hungarian notation to determine between one and the other. But what names can I use for public and private variables? I was using prv_varName and pub_varName but that sounded really strange. I've seen variable names that begin with _varName. Is that another possibility? Den
28
10430
by: Phill | last post by:
Does anyone know the reasoning for Microsoft abandoning Hungarina Notation in C#? I have found it very usefull in C++. I like this style: constant: MY_CONSTANT methos: myMethod() class: MyClass variable: iMyInteger
66
3711
by: CMM | last post by:
So after three years of working in .NET and stubbornly holding on to my old hungarian notation practices--- I resolved to try to rid myself of the habit. Man, I gotta say that it is liberating!!! I love it. At first I struggled with how to name controls. I tried to keep some sort of notation with them... but I threw that away too!!! I now name them as if they were simply properties of the form (FirstNameLabel, etc.)... which they ARE!......
24
3838
by: Ronald S. Cook | last post by:
An ongoing philosophical argument, I would like your opinions. With the release of .NET, Microsoft spoke of moving away from the notation as a best practice. I'm a believer for a few reasons: 1) Consistency throughout and knowing which objects are yours (clsEmployee, tblEmployee, frmEmployee, etc). 2) Not having to name an employee form EmployeeForm.aspx because the mane is already taken by your class named Employee.cs
6
4070
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
3
10562
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
14
1552
by: Ronald S. Cook | last post by:
I've been weaning myself off of Hungarian notation because that's what Microsoft is telling me to do, and I want to be a good little MS developer. But things keep coming up that make me miss my little 3-character prefixes. I'm fine with EmployeeFirstNameLabel instead of lblEmployeeFirstName, but at the table and class level, I get frustrated because terms I want to use reserved keywords. I wanted "Event" and "User" as classes and table...
18
4251
by: dom.k.black | last post by:
I am looking at starting a new piece of work for a company who are heavily into hungarian notation for C coding. Any killer arguments for NOT carrying this terrible practice forward into new C++ code?
12
3598
by: inhahe | last post by:
Does anybody know of a list for canonical prefixes to use for hungarian notation in Python? Not that I plan to name all my variables with hungarian notation, but just for when it's appropriate.
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.