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_emailAddress
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=h...FnTqhv-2GE1FNtA"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
news:eVFt$muGHHA.2456@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>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...
Quote:
Originally Posted by
What are the real cons for using it?
None whatever.
Quote:
Originally Posted by
I tend to use it a lot, especially when IDing my controls.
Me too - all the time.
Quote:
Originally Posted by
I find this really helpful when in codebehind.
Likewise.
Quote:
Originally Posted by
is the 'no hungarian' merely a preference MS has,
I have no idea...
Quote:
Originally Posted by
or are there specific cons to me being stubborn and sticking with it?
None whatever.
>or are there specific cons to me being stubborn and sticking with it?
Quote:
Originally Posted by
>
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
"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
news:eCtm4DvGHHA.420@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
>>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...
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" <mark@dotnet.itags.org.markNOSPAMrae.comwrote in message
news:%23G5m8uuGHHA.1252@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
news:eVFt$muGHHA.2456@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
>
Quote:
Originally Posted by
>>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...
>
Quote:
Originally Posted by
>What are the real cons for using it?
>
None whatever.
>
Quote:
Originally Posted by
>I tend to use it a lot, especially when IDing my controls.
>
Me too - all the time.
>
Quote:
Originally Posted by
>I find this really helpful when in codebehind.
>
Likewise.
>
Quote:
Originally Posted by
>is the 'no hungarian' merely a preference MS has,
>
I have no idea...
>
Quote:
Originally Posted by
>or are there specific cons to me being stubborn and sticking with it?
>
None whatever.
>
"Karl Seguin" <karlremove@dotnet.itags.org.removeopenmymindremovemetoo.andmenetwro te in
message news:%23s3IdGvGHHA.420@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
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...?
On Fri, 8 Dec 2006 10:55:56 -0600, "darrel" <notreal@dotnet.itags.org.nowhere.com>
wrote:
Quote:
Originally Posted by
>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.
Quote:
Originally Posted by
>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_emailAddress
>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.
firstNameTextBox or firstNameEdit.
Quote:
Originally Posted by
>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.
Hi,
Registered User wrote:
Quote:
Originally Posted by
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
"Laurent Bugnion" <galasoft-lb@dotnet.itags.org.bluewin.chwrote in message
news:u0ZelrvGHHA.1252@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
Registered User wrote:
>
Quote:
Originally Posted by
>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...
If anything, Intellisense makes hungarian notation even more useful!!
Excellent point!
-Darrel
On Fri, 8 Dec 2006 12:51:39 -0500, Karl Seguin wrote:
Quote:
Originally Posted by
With the advances in IDEs generally and intellisense specifically, the
question is what value does hungarian notation offer?
>
So true! Especially as VS 2005 has very good refactoring that kicks in when
you rename a variable!
--
Bits.Bytes
http://bytes.thinkersroom.com
Darrel,
for a very interesting article on the issues and history, read :
http://www.joelonsoftware.com/articles/Wrong.html
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message news:eVFt$muGHHA.2456@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>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_emailAddress
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=h...FnTqhv-2GE1FNtA
>
no.
find/replacing is dangerous. What happens if you use that same name
somewhere else but don't change its type?
I use JetBrains Resharper which provides much better refactoring than VS.NET
2005. It would do it for me. So that's a case against my own argument :)
Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mark Rae" <mark@dotnet.itags.org.markNOSPAMrae.comwrote in message
news:%23%23NtiJvGHHA.3952@dotnet.itags.org.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
"Karl Seguin" <karlremove@dotnet.itags.org.removeopenmymindremovemetoo.andmenetwro te in
message news:%23s3IdGvGHHA.420@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
>
Quote:
Originally Posted by
>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...?
>
I hope you don't use "obj" or "o" ...
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
news:eVFt$muGHHA.2456@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>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_emailAddress
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=h...FnTqhv-2GE1FNtA
>
On Fri, 08 Dec 2006 19:58:47 +0100, Laurent Bugnion
<galasoft-lb@dotnet.itags.org.bluewin.chwrote:
Quote:
Originally Posted by
>
>Very much in the contrary IMHO. I tend to forget how my variables are
>named,
I would suggest using a more meaningful naming convention but I just
can't fathom the situation you describe.
regards
A.G.
"Karl Seguin" <karlremove@dotnet.itags.org.removeopenmymindremovemetoo.andmenetwro te in
message news:uplr6jwGHHA.1240@dotnet.itags.org.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
find/replacing is dangerous. What happens if you use that same name
somewhere else but don't change its type?
Then I would correct it on the unlikely event that that would occur...
Also, I wouldn't just blithely hit "Replace all"...
Quote:
Originally Posted by
I use JetBrains Resharper which provides much better refactoring than
VS.NET 2005. It would do it for me. So that's a case against my own
argument :)
LOL! Well there you go!
I do use o for local objects, mo for class or module level and go for global
objects. Hungarian Notation rocks and after using it for the last 15 years I've
yet to see a good reason not to.
On Fri, 8 Dec 2006 15:41:22 -0500, "Karl Seguin"
<karlremove@dotnet.itags.org.removeopenmymindremovemetoo.andmenetwro te:
Quote:
Originally Posted by
>I hope you don't use "obj" or "o" ...
"Jay Pondy" <jpondy@dotnet.itags.org.bellsouth.netwrote in message
news:vaujn21kt4atccu18o7osnvj2ur2ctjd4i@dotnet.itags.org.4ax.com...
Quote:
Originally Posted by
Hungarian Notation rocks and after using it for the last 15 years I've
yet to see a good reason not to.
Likewise.
That is a very good article. I wish I had known about Apps Hungarian because
apparently I am an abuser of Apps System where the type is a small part of the
variable naming convention rather than the "kind" of thing it is.
When I see code that does not use Hungarian notation I feel like half my brain
is turned off and I then have to work twice as hard to stay in the same place.
Joel does an excellent job of explaining why and where that perception comes
from.
Thanks for a great perspective.
On Fri, 8 Dec 2006 15:30:13 -0400, "Juan T. Llibre" <nomailreplies@dotnet.itags.org.nowhere.com>
wrote:
Quote:
Originally Posted by
>Darrel,
>
>for a very interesting article on the issues and history, read :
>
>http://www.joelonsoftware.com/articles/Wrong.html
>
>
>
>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en espaol : http://asp.net.do/foros/
>===================================
>"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message news:eVFt$muGHHA.2456@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>>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_emailAddress
>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=h...FnTqhv-2GE1FNtA
>>
>
Thus wrote Mark,
Quote:
Originally Posted by
"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
news:eCtm4DvGHHA.420@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>>>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.
Cheers.
--
Joerg Jooss
news-reply@dotnet.itags.org.joergjooss.de
Thus wrote Joerg,
Quote:
Originally Posted by
Thus wrote Mark,
>
Quote:
Originally Posted by
>"darrel" <notreal@dotnet.itags.org.nowhere.comwrote in message
>news:eCtm4DvGHHA.420@dotnet.itags.org.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
>>>>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
news-reply@dotnet.itags.org.joergjooss.de
"Joerg Jooss" <news-reply@dotnet.itags.org.joergjooss.dewrote in message
news:94fc50715ccba8c8e99f0d1ddd0c@dotnet.itags.org.msnews.microsoft .com...
Quote:
Originally Posted by
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...
Quote:
Originally Posted by
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?
On Sat, 9 Dec 2006 11:02:10 -0000, "Mark Rae" <mark@dotnet.itags.org.markNOSPAMrae.com>
wrote:
Quote:
Originally Posted by
>
>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_CustomerID {...}
public string str_CustomerName {...}
...
}
regards
A.G.
"Registered User" <n4jvp@dotnet.itags.org.ix.netcom.comwrote in message
news:o9aln2lnma6re9pf5frnign1o3gnneok58@dotnet.itags.org.4ax.com...
Quote:
Originally Posted by
Quote:
Originally Posted by
>>E.g. imagine a Customer class with a CustomerID property - what datatype
>>is
>>CustomerID?
>>
I dunno
Of course you don't...How could you...?
Quote:
Originally Posted by
it might be a value type instead.
Instead of what...?
Quote:
Originally Posted by
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...
Quote:
Originally Posted by
I find this ability especially helpful when working with generics.
Me too.
Quote:
Originally Posted by
The question itself reads as if you are suggesting being consistant
and using hungarian notation in every scope.
I most certainly am.
Quote:
Originally Posted by
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!
On Sat, 9 Dec 2006 13:28:07 -0000, "Mark Rae" <mark@dotnet.itags.org.markNOSPAMrae.com>
wrote:
Quote:
Originally Posted by
>"Registered User" <n4jvp@dotnet.itags.org.ix.netcom.comwrote in message
>news:o9aln2lnma6re9pf5frnign1o3gnneok58@dotnet.itags.org.4ax.com...
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>>>E.g. imagine a Customer class with a CustomerID property - what datatype
>>>is
>>>CustomerID?
>>>
>I dunno
>
>Of course you don't...How could you...?
>
Quote:
Originally Posted by
>it might be a value type instead.
>
>Instead of what...?
Instead of a nullable datatype.
Quote:
Originally Posted by
>
Quote:
Originally Posted by
>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.
Quote:
Originally Posted by
Quote:
Originally Posted by
>I find this ability especially helpful when working with generics.
>
>Me too.
>
It doesn't take much to make CustomerID a generic.
public Customer<CustomerID>
{
public CustomerID CustomerID{...}
...
}
If this isn't riddle then this should be either
public Customer<CustomerID>
{
public int CustomerID{...}
...
}
Quote:
Originally Posted by
Quote:
Originally Posted by
>The question itself reads as if you are suggesting being consistant
>and using hungarian notation in every scope.
>
>I most certainly am.
>
Quote:
Originally Posted by
>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.
0 comments:
Post a Comment