Naming Conventions -- Opinions please...
Author |
Message |
TK Herma #1 / 7
|
 Naming Conventions -- Opinions please...
Ok, so we're debating at our office about switching from the old Hungarian notion style of naming conventions to the Pascal/Camel Case style now promoted by Microsoft. I've coded applications both ways and like the Pascal/Camel Case style better b/c it just "seems" more clean. However, I'm running into some resistance from a few of our other developers who have never tried it before and think it will make the code more difficult to read. And, when asked why we should switch I don't really have a good answer other than it's the "standard" that Microsoft is now suggesting. Our other lead developer has said that if there is some benefit to not using Hungarian then he's all for it but isn't convinced we should switch just to switch. (Likewise, if it's not a good idea and there's not a solid reason then I'm for sticking with the old way.) So, I'm curious about two things -- first, what are you all out there using? And second, can anyone point me to some documentation that might compare and contrast the two different styles? Or any other documentation out there that talks about what the "preferred" naming conventions are in the .NET world. Thanks in advance for your input! TK Herman
|
Sat, 11 Jun 2005 02:47:53 GMT |
|
 |
Marin #2 / 7
|
 Naming Conventions -- Opinions please...
Right off the bat, doing a search on google, brings up: http://www.flashdaddee.com/Books-Technical/Inside CSharp/32ch03f.htm I suggest you do a search yourself, and you will find plenty of web sites. One good reason, is for consistency. If you are producing a product or component, developers using it should not see a big difference in naming conventions. Also, since your developers will be using the .NET framework, they need to get familiar with the new naming convention - at this point, why not use it?
Quote: > Ok, so we're debating at our office about switching from the old Hungarian > notion style of naming conventions to the Pascal/Camel Case style now > promoted by Microsoft. I've coded applications both ways and like the > Pascal/Camel Case style better b/c it just "seems" more clean. However, I'm > running into some resistance from a few of our other developers who have > never tried it before and think it will make the code more difficult to > read. And, when asked why we should switch I don't really have a good > answer other than it's the "standard" that Microsoft is now suggesting. Our > other lead developer has said that if there is some benefit to not using > Hungarian then he's all for it but isn't convinced we should switch just to > switch. (Likewise, if it's not a good idea and there's not a solid reason > then I'm for sticking with the old way.) > So, I'm curious about two things -- first, what are you all out there using? > And second, can anyone point me to some documentation that might compare and > contrast the two different styles? Or any other documentation out there > that talks about what the "preferred" naming conventions are in the .NET > world. > Thanks in advance for your input! > TK Herman
|
Sat, 11 Jun 2005 03:11:42 GMT |
|
 |
Steve C. Orr, MCS #3 / 7
|
 Naming Conventions -- Opinions please...
One good reason to switch is that Hungarian Notation just doesn't cut it anymore. I tried to keep using it and found it was almost impossible to keep using it consistently. Hungarian notation involves having a prefix for each object type. In VB6 there was a fairly finite number of object types so this was a nice and clean approach. But now you have the entire CLR filled with THOUSANDS of different types of objects. I sure wouldn't want to be the person to come up with all those prefixes and write the associated documentation, would you? ;-) I'm not saying I love this new camel case notation Microsoft is suggesting, but I have yet to see anybody come up with a better suggestion. For what it's worth, I still generally use Hungarian Notation for control names since there is still a fairly finite number of those. -- I hope this helps, Steve C. Orr, MCSD http://Steve.Orr.net
Quote: > Ok, so we're debating at our office about switching from the old Hungarian > notion style of naming conventions to the Pascal/Camel Case style now > promoted by Microsoft. I've coded applications both ways and like the > Pascal/Camel Case style better b/c it just "seems" more clean. However, I'm > running into some resistance from a few of our other developers who have > never tried it before and think it will make the code more difficult to > read. And, when asked why we should switch I don't really have a good > answer other than it's the "standard" that Microsoft is now suggesting. Our > other lead developer has said that if there is some benefit to not using > Hungarian then he's all for it but isn't convinced we should switch just to > switch. (Likewise, if it's not a good idea and there's not a solid reason > then I'm for sticking with the old way.) > So, I'm curious about two things -- first, what are you all out there using? > And second, can anyone point me to some documentation that might compare and > contrast the two different styles? Or any other documentation out there > that talks about what the "preferred" naming conventions are in the .NET > world. > Thanks in advance for your input! > TK Herman
|
Sat, 11 Jun 2005 03:53:30 GMT |
|
 |
Greg Lo #4 / 7
|
 Naming Conventions -- Opinions please...
We're still debating it too. We are definitely still using it for control names. The MS courseware has amazing examples of how not to do it eg: CustomerNameTextBox or SignatureCheckBox. Having read a lot of example code, I find the lack of a scope definition (eg gstrCustomerName or mstrCustomerName vs strCustomerName) confuses the code. It isn't clear what the scope of a variable is when you see it in a procedure. In the examples I see the other issue that comes up is the reference to an object's own properties without some object prefix eg Me.OrderNumber vs OrderNumber. Without some prefix, it is not clear that a variable is actually a reference to an object. Regardless of the number of new objects, few are used in any given context and it isn't hard to have a suitable prefix for them. The other problem it introduces relates to situations where you hold a particular value in two forms eg as a string and as a number eg strCount and intCount. Even if you are developing objects for others, no-one is suggesting you camelCase the property and method names so that shouldn't be an issue for others using your objects. Just my 2c. (Had to play the devil's advocate) Greg Low Brisbane, Oztralia
Quote: > Ok, so we're debating at our office about switching from the old Hungarian > notion style of naming conventions to the Pascal/Camel Case style now > promoted by Microsoft. I've coded applications both ways and like the > Pascal/Camel Case style better b/c it just "seems" more clean. However, I'm > running into some resistance from a few of our other developers who have > never tried it before and think it will make the code more difficult to > read. And, when asked why we should switch I don't really have a good > answer other than it's the "standard" that Microsoft is now suggesting. Our > other lead developer has said that if there is some benefit to not using > Hungarian then he's all for it but isn't convinced we should switch just to > switch. (Likewise, if it's not a good idea and there's not a solid reason > then I'm for sticking with the old way.) > So, I'm curious about two things -- first, what are you all out there using? > And second, can anyone point me to some documentation that might compare and > contrast the two different styles? Or any other documentation out there > that talks about what the "preferred" naming conventions are in the .NET > world. > Thanks in advance for your input! > TK Herman
|
Sat, 11 Jun 2005 06:45:19 GMT |
|
 |
Scott Swigar #5 / 7
|
 Naming Conventions -- Opinions please...
3 character prefix for user interface elements (Label = lbl, Button = btn, TextBox = txt, etc.) No prefixes for anything else. camelCase for variables. PascalCase for properties, methods, classes, etc. -- - Scott Swigart www.3leaf.com weblog: http://radio.weblogs.com/0117167/
Quote: > Ok, so we're debating at our office about switching from the old Hungarian > notion style of naming conventions to the Pascal/Camel Case style now > promoted by Microsoft. I've coded applications both ways and like the > Pascal/Camel Case style better b/c it just "seems" more clean. However, I'm > running into some resistance from a few of our other developers who have > never tried it before and think it will make the code more difficult to > read. And, when asked why we should switch I don't really have a good > answer other than it's the "standard" that Microsoft is now suggesting. Our > other lead developer has said that if there is some benefit to not using > Hungarian then he's all for it but isn't convinced we should switch just to > switch. (Likewise, if it's not a good idea and there's not a solid reason > then I'm for sticking with the old way.) > So, I'm curious about two things -- first, what are you all out there using? > And second, can anyone point me to some documentation that might compare and > contrast the two different styles? Or any other documentation out there > that talks about what the "preferred" naming conventions are in the .NET > world. > Thanks in advance for your input! > TK Herman
|
Sat, 11 Jun 2005 07:39:44 GMT |
|
 |
Jarrod Shar #6 / 7
|
 Naming Conventions -- Opinions please...
concur with Scott's suggestion - my choice also. only 'problem' is the many new interface elements now available. is there a 'standard' list of the 3 letter prefixes for .NET? eg for NotifyIcon I use ntiWhatever but wonder what others use. what i'd love to help easily distinguish between variables and properties etc is the ability to change their colour in the Tools-Options-Fonts and Colors. the best you can do is change the colour for 'Identifier' so both change together. jarrod
Quote: > 3 character prefix for user interface elements (Label = lbl, Button = btn, > TextBox = txt, etc.) > No prefixes for anything else. > camelCase for variables. > PascalCase for properties, methods, classes, etc. > -- > - Scott Swigart > www.3leaf.com > weblog: http://radio.weblogs.com/0117167/
> > Ok, so we're debating at our office about switching from the old Hungarian > > notion style of naming conventions to the Pascal/Camel Case style now > > promoted by Microsoft. I've coded applications both ways and like the > > Pascal/Camel Case style better b/c it just "seems" more clean. However, > I'm > > running into some resistance from a few of our other developers who have > > never tried it before and think it will make the code more difficult to > > read. And, when asked why we should switch I don't really have a good > > answer other than it's the "standard" that Microsoft is now suggesting. > Our > > other lead developer has said that if there is some benefit to not using > > Hungarian then he's all for it but isn't convinced we should switch just > to > > switch. (Likewise, if it's not a good idea and there's not a solid reason > > then I'm for sticking with the old way.) > > So, I'm curious about two things -- first, what are you all out there > using? > > And second, can anyone point me to some documentation that might compare > and > > contrast the two different styles? Or any other documentation out there > > that talks about what the "preferred" naming conventions are in the .NET > > world. > > Thanks in advance for your input! > > TK Herman
|
Sat, 11 Jun 2005 13:30:18 GMT |
|
 |
Scott Swigar #7 / 7
|
 Naming Conventions -- Opinions please...
I've posted the list of recommended prefixes to my weblog: http://radio.weblogs.com/0117167/ -- - Scott Swigart www.3leaf.com weblog: http://radio.weblogs.com/0117167/
Quote: > concur with Scott's suggestion - my choice also. only 'problem' is the many > new interface elements now available. is there a 'standard' list of the 3 > letter prefixes for .NET? eg for NotifyIcon I use ntiWhatever but wonder > what others use. > what i'd love to help easily distinguish between variables and properties > etc is the ability to change their colour in the Tools-Options-Fonts and > Colors. the best you can do is change the colour for 'Identifier' so both > change together. > jarrod
> > 3 character prefix for user interface elements (Label = lbl, Button = btn, > > TextBox = txt, etc.) > > No prefixes for anything else. > > camelCase for variables. > > PascalCase for properties, methods, classes, etc. > > -- > > - Scott Swigart > > www.3leaf.com > > weblog: http://radio.weblogs.com/0117167/
> > > Ok, so we're debating at our office about switching from the old > Hungarian > > > notion style of naming conventions to the Pascal/Camel Case style now > > > promoted by Microsoft. I've coded applications both ways and like the > > > Pascal/Camel Case style better b/c it just "seems" more clean. However, > > I'm > > > running into some resistance from a few of our other developers who have > > > never tried it before and think it will make the code more difficult to > > > read. And, when asked why we should switch I don't really have a good > > > answer other than it's the "standard" that Microsoft is now suggesting. > > Our > > > other lead developer has said that if there is some benefit to not using > > > Hungarian then he's all for it but isn't convinced we should switch just > > to > > > switch. (Likewise, if it's not a good idea and there's not a solid > reason > > > then I'm for sticking with the old way.) > > > So, I'm curious about two things -- first, what are you all out there > > using? > > > And second, can anyone point me to some documentation that might compare > > and > > > contrast the two different styles? Or any other documentation out there > > > that talks about what the "preferred" naming conventions are in the .NET > > > world. > > > Thanks in advance for your input! > > > TK Herman
|
Mon, 13 Jun 2005 12:26:31 GMT |
|
|
|