View Single Post
  #2 (permalink)  
Old 05-30-2006, 03:13 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Credits: 0
Rep Power: 11
brackett is on a distinguished road
Default

IME, the first style is called camelCase, and the second PascalCase. Note that this Wikipedia article, however, says they are both camel case and should be called lowerCamelCase or UpperCamelCase (edit: that used to say UpperPascalCase, which is wrong...oops). I say I've never heard of such terms - but do realize that wiki engines in general call PascalCase camelCase. I submit the .NET Framework Design Guidelines on Capitalization in my defense.

For .NET, Microsoft has the above design guideline for the BCL. I'm sure Java has something similar. It's probably advisable to follow those guidelines, so here's the relevant portions of the .NET one:
a. camelCase for parameters, local and (non public) member variables
b. PascalCase for classes, enum types and values, properties, functions, events, readonly statics, public member variables, interfaces, namespaces, and acronyms more than 2 letters long
c. no Hungarian notation
d. no prefix for member variables (I'm not entirely sure this is in there, I know it recommends against underscores for class names, but others have stated it does as well for member variables. I do know, however, that you cannot be CLS compliant with an underscore prefix)

And, now that I have given the "official" recommendation, here's how I actually do it for both VB.NET and C#:
a. camelCase for local variables and parameters
b. PascalCase for pretty much everything else
c. _camelCase (camelCase with a leading underscore) for private or protected member variables
d. ALL_CAPS_WITH_UNDERSCORE for constants
e. Hungarian notation only for web or WinForm control variables

IOW, it's a strange mix of .NET guidelines and my own peculiariaties. Oh well, at least I'm consistent.

Last edited by brackett; 05-30-2006 at 07:06 PM.
Reply With Quote