473,769 Members | 5,072 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 #1
24 2378
"darrel" <no*****@nowher e.comwrote in message
news:eV******** ******@TK2MSFTN GP06.phx.gbl...
>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
Weird, isn't it! It was all the rage for years, then suddenly they don't
like it any more...
What are the real cons for using it?
None whatever.
I tend to use it a lot, especially when IDing my controls.
Me too - all the time.
I find this really helpful when in codebehind.
Likewise.
is the 'no hungarian' merely a preference MS has,
I have no idea...
or are there specific cons to me being stubborn and sticking with it?
None whatever.
Dec 8 '06 #2
>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)

-Darrel
Dec 8 '06 #3
The biggest argument against hungarian notation is that it makes it harder
to refactor code. People argue that it's violates the Don't Repeat Yourself
(DRY) principle. Personally, I think that's a little much, but the side
effect IS the same. If you change the type of your variable, you now need to
change all instances of that variable.

if you have rptBooks and want to change it to a datagrid, you now have to
refactor your name or risk having hard code to maintain.

With the advances in IDEs generally and intellisense specifically, the
question is what value does hungarian notation offer?

I'd be interested in taking a look at a codebehind page you feel it ads
value.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"darrel" <no*****@nowher e.comwrote in message
news:eV******** ******@TK2MSFTN GP06.phx.gbl...
>>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

Weird, isn't it! It was all the rage for years, then suddenly they don't
like it any more...
>What are the real cons for using it?

None whatever.
>I tend to use it a lot, especially when IDing my controls.

Me too - all the time.
>I find this really helpful when in codebehind.

Likewise.
>is the 'no hungarian' merely a preference MS has,

I have no idea...
>or are there specific cons to me being stubborn and sticking with it?

None whatever.
Dec 8 '06 #4
"darrel" <no*****@nowher e.comwrote in message
news:eC******** *****@TK2MSFTNG P06.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...
Dec 8 '06 #5
"Karl Seguin" <ka********@rem oveopenmymindre movemetoo.andme netwrote in
message news:%2******** *******@TK2MSFT NGP06.phx.gbl.. .
If you change the type of your variable, you now need to change all
instances of that variable.
Personally, I would use Find / Replace for such a task - wouldn't you...?
Dec 8 '06 #6
On Fri, 8 Dec 2006 10:55:56 -0600, "darrel" <no*****@nowher e.com>
wrote:
>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?
Nothing although the various 'dialects' can be confusing and
internally inconsistent.
>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_firstNam e
tbx_emailAddre ss
ddl_state

I find this really helpful when in codebehind.
My preference is to be verbose as needed to make the code easier to
read. A few extra key strokes for clarity can go a long a way i.e.
firstNameTextBo x or firstNameEdit.
>is the 'no hungarian' merely a preference MS has, or are there specific cons
to me being stubborn and sticking with it?
You may run into situations where corporate/department/office policy
does not appreciate hungarian notation as much as you do. For all
practical purposes IntelliSense and similar tools make hungarian
notation obsolete.

regards
A.G.
Dec 8 '06 #7
Hi,

Registered User wrote:
You may run into situations where corporate/department/office policy
does not appreciate hungarian notation as much as you do. For all
practical purposes IntelliSense and similar tools make hungarian
notation obsolete.

regards
A.G.
Very much in the contrary IMHO. I tend to forget how my variables are
named, especially which letter they start with, but I do not forget
which type they have. If I want a string, I type "str" and all the
strings are nicely grouped in Intellisense. If anything, Intellisense
makes hungarian notation even more useful!!

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 8 '06 #8
"Laurent Bugnion" <ga*********@bl uewin.chwrote in message
news:u0******** ******@TK2MSFTN GP02.phx.gbl...
Registered User wrote:
>You may run into situations where corporate/department/office policy
does not appreciate hungarian notation as much as you do. For all
practical purposes IntelliSense and similar tools make hungarian
notation obsolete.

regards
A.G.

Very much in the contrary IMHO. I tend to forget how my variables are
named, especially which letter they start with, but I do not forget which
type they have. If I want a string, I type "str" and all the strings are
nicely grouped in Intellisense. If anything, Intellisense makes hungarian
notation even more useful!!
Tout à fait d'accord avec toi, mon pote!

Which is to say that I agree entirely with Laurent.

Hungarian notation makes it easier for me to write my applications - if I
didn't use it, it would make it more difficult for me to write my
applications.

I think the OP would also agree with the above...
Dec 8 '06 #9
If anything, Intellisense makes hungarian notation even more useful!!

Excellent point!

-Darrel
Dec 8 '06 #10

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
4069
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
1551
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
9423
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
10214
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...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
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
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.