CamelCase naming convention
-
...oh, and Lisp is cool. And so is Haskell :) Definitely been hanging too much with the dark side :). But this all leads me to believe, without doubt, that you're wrong. Speaking of inane deductions, which your post exemplifies! ;P
Paul
The flight towards the light I'll stay in the lava for life Ísland
If you want to talk about the dark side, I've been working in Perl lately! So I use what's appropriate for the language. For C++, I use camelCase. For Perl, I use @the_underscores. (I do have to admit - C#? Get away, get away! is my opinion about that language.)
-
Terry Meritt wrote:
Anyhow it is part of the accepted coding conditions for VB programming.
I admit I didn't have VB in mind when I started the thread :)
The best thing would be for everyone to follow the accepted coding conventions for the language they are using. Sure makes it a whole lot easier when you have to take over an existing project if the previous programmer did use the coding conventions. I have re-written enough apps in my time because the orginal or previous programmer didn't follow them and it took me extra time to decode.
-
The best thing would be for everyone to follow the accepted coding conventions for the language they are using. Sure makes it a whole lot easier when you have to take over an existing project if the previous programmer did use the coding conventions. I have re-written enough apps in my time because the orginal or previous programmer didn't follow them and it took me extra time to decode.
Terry Meritt wrote:
The best thing would be for everyone to follow the accepted coding conventions for the language they are using.
Sure. However, for languages such as C there are no accepted coding conventions and the usage varies drastically.
-
I would refer the honourable gentleman to the following[^]. Of course, each to his own, but the document above is possibly the reason as far as C# is concerned.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Henry Minute wrote:
the document above is possibly the reason as far as C# is concerned
It's more that Microsoft language source has always been camel and pascal case (formerly adorned with Hungarian).
Kevin
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
I agree that underscores are easier to read. Eiffel follows this convention precisely for this reason. However, I personally find camel and pascal easier to write. You're mainly a C++ guy aren't you? So I guess you're most likely immersed in the likes of STL and Boost, which use underscores?
Kevin
-
Nemanja Trifunovic wrote:
Lispers have the best of both worlds (well, except for the parentheses): (get-my-precious-data-from-an-XML-file)
Surely Lispers should have ...
(get-my-prethiouth-data-from-an-EkthML-file)
?------------------------------------ "I am always serious about what I do, not necessarily about how I do it." Tom Baker
ThatShouldHaveBeenTheLastWordOnTheMatter but IF-ALL-YOUVE-GOT-IS-A-BAUDOT-TELETYPE-THEN-YOU-DONT-HAVE-THE-LUXURY-OF-LOWERCASE which is probably why Cobol & Fortran programs usually employ HYPHENATED-UPPER-CASE
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
I usually use both when I get stuck with a long name. Why not Get_MyPreciousData_From_AnXMLFile() I find this makes it easier to read the key components by grouping adjective/noun groups and separating with underscores. In practice, I find I rarely have to use this and when I do, I usually only need one underscore and never more than two. My real preference would be break the operation into objects and use myXMLFile.PreciousData() or myPreciousData.LoadFrom(myXMLFile) or new PreciousData(myXMLFile) When push comes to shove, though don't pick an either-or solution. Combine them for easiest reading.
-
Steve_Harris wrote:
As you have to press Shift to get an underscore, I'd say about the same.
Exactly - which is why I said that underscores are easy to read but hard to write.
Nemanja Trifunovic wrote:
Steve_Harris wrote: As you have to press Shift to get an underscore, I'd say about the same. Exactly - which is why I said that underscores are easy to read but hard to write.
NOT EXACTLY. You have to insert 16 EXTRA shifted characters, so that is 32 EXTRA key presses for the same lower-case function call - 16 shifts and 16 underscores extra, versus 16 extra shift for upper-case only. Personally, I don't like UGLY code, and mixing styles makes the overall code ugly. So, I use the MS standard (standard of the language/day) or the Linux/C standard, or Borland, or whatever, just so there is a common style throughout. strHungarian, under_scores, CamelCase, or _ALLCAPS - use them all. Not saying I like it, but the code is pretty. Now, if it would only work as well as it looks. X|
Gary
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
I can read camelCase more easily than underscores. Mainly because I've seen much more camelCase code. The extra benefit is that I have shorter lines because of shorter variable names. I try to keep within 80 characters of width per line because I hate scrolling horizontally. Doing underscores feels unusual because I'm not used to holding Shift and hitting any key outside of the character keys.
-
Computafreak wrote:
IHaveNeverReallyHadThisProblemBecauseIFindItEasyToBothReadAndWrit
You find that easy to read? :~ As for ease of writing, how many time did you have to press Shift?
Dude, really... that's like asking how many times you has to press the letter 'e'. What is it about everyone that is scared of typing? C++ people say that VB is 'too verbose'. now the discussion about uppercase letters... Just work in assembler, or machine language.
-
M Towler wrote:
we use both at the same time, so everyone is offended
But at least everybody knows the other side is offended as well :)
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
I have always disliked underscores in names for a reason no one has mentioned: When I am visually scanning code, spaces between strings of characters indicate the end of one name and the beginning of another, and underscores look a lot like spaces. This makes it harder for me to understand the code quickly. Code and prose are two different things. Of course, I also strongly dislike having to add that extra underscore character with a shift and awkward reach to a key at the top of the keyboard that I have to look for, since it falls outside the scope of my touch typing practice. And, in some display situations, the underscore disappears in an underline of the whole name. And, what is most frustrating, I have occasionally seen two or more underscores used together. In many fonts, it is very difficult to tell how many underscores there actually are.
-
Why most programmers (at least Windows and Java programmers) use this horrible notation? It is both hard to write and hard to read:
GetMyPreciousDataFromAnXMLFile()
With undrescores it is at least easy to read if not to write:
get_my_precious_data_from_an_XML_file()
And of course, there is always a way to make it easy to write but hard to read:
getmypreciousdatafromanXMLfile()
Lispers have the best of both worlds (well, except for the parentheses):
(get-my-precious-data-from-an-XML-file)
I feel better now - feel free to vote me down :)
-
I really don't like having underscores in method or variable names :~. Just a matter of choice. And I find the CamelCase notation not really difficult to read or write.
Cédric Moonen Software developer
Charting control [v2.0 - Updated] OpenGL game tutorial in C++Cedric Moonen wrote:
I really don't like having underscores in method or variable names Unsure. Just a matter of choice. And I find the CamelCase notation not really difficult to read or write.
totally agree... I hate using underscores in methods and variable names.. I think the best and easiest to read and write is CamelCasing :) ICouldReadACamelCasedBookWithoutAnyProblems :-D