Camel case

  • Thread starter Thread starter Bob Rosen
  • Start date Start date
B

Bob Rosen

Can anyone provide an intrinsic justification (i.e. not related to
popularity or standardization) for using camel case notation? Just saying
to distinguish certain variable types is not sufficient in my mind because
there ARE other notations besides camel and Pascal, after all!

Bob Rosen
 
You'll find Camel Casing a standard convention in languages like C, Java,
C#, etc.

These languages are case-sensitive. I can't say for sure, but I'll bet that
because of the case-sensitivity and the fact that it's easier to type in
lower case than upper (Pascal Casing), camel was devised.

For example, a class named "person" would be typed in all lower case, thus
never needing to type a cap. However, when you want to create a name that
combines 2 words, it becomes difficult to read the name because the words
run together, so voilla! The second and subsequent words are capitalized.

Just guessing here.
 
Can you provide intrinsic justification for any notation?
(As a little note, the hungarian notation argument that it tells you the
variable type works both as an argument to use it (sometimes it does tell
you the type) and to not use it(sometimes its wrong), so that really won't
work.
 
Bob,
Just saying
to distinguish certain variable types is not sufficient in my mind because
camelCasing is independant of distinguishing variable types!

You can use both Camel & Pascal casing without identifying any type
information. I normally include only type or only purpose in the identifier
name, rarely both.

Camel & Pascal Casing are used to signify word breaks in an identifier,
alternatives include underscores or other special characters (in COBOL we
used Hyphens). I tend to find camelCasing & PascalCasing easier to read then
underscores or all caps & hyphens.

Or as the below web site states about Camel & Pascal case that "the first
letter of each subsequent concatenated word are capitalized"

http://msdn.microsoft.com/library/d...s/cpgenref/html/cpconcapitalizationstyles.asp

For private variables I will use m_ to identify private member variables,
otherwise I avoid underscores in identifiers.

samples:
camelCasing
PascalCasing
COBOL-CASING
underscore_casing

I find the first two more readable then the last two, granted COBOL-CASING
is not valid C# or VB.NET identifier.

Hope this helps
Jay
 
I've thought of:

lisp-casing
TRADITIONAL_BASIC_CASING
_alternativeMemberCasing
anotherMemberCasing_
 
Back
Top