Click here to Skip to main content
15,912,299 members

Survey Results

Naming conventions in your code   [Edit]

Survey period: 24 Nov 2003 to 30 Nov 2003

What notations do you use when coding?

OptionVotes% 
Hungarian notation with prefixes (strFirstName, m_nNumber etc)76150.13
Hungarian notation without prefixes ( _nNumber etc)432.83
Camel Caps (numberOfDays, isValid etc)46230.43
Pascal case (BackColor, DataSet)17911.79

View optional text answers (92 answers)


 
GeneralRe: Gool ol' Hungarian Pin
J.B27-Nov-03 16:20
J.B27-Nov-03 16:20 
GeneralRe: Gool ol' Hungarian Pin
ashleyb27-Nov-03 13:16
ashleyb27-Nov-03 13:16 
GeneralRe: Gool ol' Hungarian Pin
Blake Miller24-Nov-03 10:54
Blake Miller24-Nov-03 10:54 
GeneralRe: Gool ol' Hungarian Pin
Alvaro Mendez24-Nov-03 9:17
Alvaro Mendez24-Nov-03 9:17 
GeneralRe: Gool ol' Hungarian Pin
Ravi Bhavnani24-Nov-03 9:40
professionalRavi Bhavnani24-Nov-03 9:40 
GeneralRe: Gool ol' Hungarian Pin
Mike Osbahr27-Nov-03 4:55
Mike Osbahr27-Nov-03 4:55 
GeneralRe: Gool ol' Hungarian Pin
Anonymous27-Nov-03 9:09
Anonymous27-Nov-03 9:09 
GeneralRe: Gool ol' Hungarian Pin
Alvaro Mendez28-Nov-03 5:20
Alvaro Mendez28-Nov-03 5:20 
My reply to Michael was meant more as a joke than an argument.

I'm aware of Hungarian notation's pros and cons, and I've chosen to get away from it because I believe the cons outweigh the pros. I used Hungarian notation for many years (and still do when maintaining old code), but was forced to stop using it a couple of years ago when I started doing Java. To my surprise, I began to like the way my code looked without the prefixes in all my variables. It was just easier to read.

I guess it boils down to personal preference. What do you like better?

void RepeatName(string strName, int nTimes, bool bInCaps)
{
  if (bInCaps)
    strName = strName.ToUpper();
	
  for (int nTime = 0; nTime < nTimes; nTime++)
    Print(strName);
}

or

void RepeatName(string name, int times, bool inCaps)
{
  if (inCaps)
    name = name.ToUpper();
	
  for (int i = 0; i < times; i++)
    Print(name);
}


Both pieces of code are fine, but I prefer the second version. Also, when looking at this method's signature via Intellisense, I prefer to see the names of the parameters without the prefixes, which just get in the way IMHO.

Regards,
Alvaro


He who laughs last, thinks slowest.
GeneralRe: Gool ol' Hungarian Pin
Shog924-Nov-03 14:27
sitebuilderShog924-Nov-03 14:27 
GeneralHungarian is evil Pin
Navin25-Nov-03 4:54
Navin25-Nov-03 4:54 
GeneralRe: Hungarian is evil Pin
Tim Smith25-Nov-03 16:54
Tim Smith25-Nov-03 16:54 
GeneralRe: Hungarian is evil Pin
Navin26-Nov-03 3:16
Navin26-Nov-03 3:16 
GeneralRe: Gool ol' Hungarian Pin
deo25-Nov-03 12:15
deo25-Nov-03 12:15 
GeneralRe: Gool ol' Hungarian Pin
Patje25-Nov-03 22:58
Patje25-Nov-03 22:58 
GeneralRe: Gool ol' Hungarian Pin
Mehdi Mousavi26-Nov-03 1:40
Mehdi Mousavi26-Nov-03 1:40 
GeneralRe: Gool ol' Hungarian Pin
peterchen29-Nov-03 2:53
peterchen29-Nov-03 2:53 
GeneralOnly habits... Pin
andyj11524-Nov-03 2:14
andyj11524-Nov-03 2:14 
GeneralRe: Only habits... Pin
Anonymous24-Nov-03 8:32
Anonymous24-Nov-03 8:32 
GeneralRe: Only habits... Pin
Dimitris Vasiliadis25-Nov-03 9:22
Dimitris Vasiliadis25-Nov-03 9:22 
GeneralRe: Only habits... Pin
andyj11525-Nov-03 9:37
andyj11525-Nov-03 9:37 
GeneralRe: Only habits... Pin
Dimitris Vasiliadis25-Nov-03 20:06
Dimitris Vasiliadis25-Nov-03 20:06 
GeneralRe: Only habits... Pin
Navin25-Nov-03 9:47
Navin25-Nov-03 9:47 
GeneralRe: Only habits... Pin
John R. Shaw25-Nov-03 9:53
John R. Shaw25-Nov-03 9:53 
GeneralRe: Only habits... Pin
andyj11525-Nov-03 10:20
andyj11525-Nov-03 10:20 
GeneralRe: Only habits... Pin
John R. Shaw25-Nov-03 10:46
John R. Shaw25-Nov-03 10:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.