CamelCase naming convention
-
Ah, but you're wrong, and you've hit the nail on the head! VIM is the best thing since sliced bread (who even needs a mouse anyway? and gui's? curses on all my friends!), although I'm sure it existed before sliced bread, and leftists are actually quite an agreeable bunch. So, unfortunately, I'm going to have to conclude that *you're* wrong. :)
Paul
The flight towards the light I'll stay in the lava for life Ísland
Preposterous! Absurdities stacked on inanities, turgid logic piled upon vapid conundrums! I'm convinced beyond a shadow of a doubt that you're wrong!
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh
-
Preposterous! Absurdities stacked on inanities, turgid logic piled upon vapid conundrums! I'm convinced beyond a shadow of a doubt that you're wrong!
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh
...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
-
Nemanja Trifunovic wrote:
Anyway, I can't argue with the "aesthetically pleasing" part, but it is equally hard to type.
I think capital letters are far easier to type than an underscore. All the letters on my keyboard are just one key away, whereas the underscore I have to move my cute lil' pinky up two rows. My left ring finger can handle taking up the responsibility of the left pinky just find. Hmm, talking about fingers is really weird. Good topic though! I reckon being able to type with spaces would be better, and have the editor condense it to whatever form is required. Interestingly, on that topic, I don't actually type the capitals much any more, I type about half the method in lower case, then ctrl+space finishes the word for me, and fixes up my capitalisation. Yay for tools!
Phil Martin... wrote:
I type about half the method in lower case, then ctrl+space finishes the word for me, and fixes up my capitalisation. Yay for tools!
Same here, except that I use vim's Ctrl-P :)
-
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 :)
Just use shorter identifiers. I've started to use namespaces a lot for that reason. I use a notation that looks like this: IO::Backup::Database(...). My apologies if namespaces aren't available in your toolset. Personally, I prefer camel case over underscores in long identifiers.
-- Kein Mitleid Für Die Mehrheit
-
I guess my first name has made a good impression on you then? Not sure if I want to impress you even further with Jörgën though. People could mistake me for a french man! ;)
-- Kein Mitleid Für Die Mehrheit
-
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 :)
The main problem in you examples is not the case, but the lenght of the function. GetMyXML() is not difficult to read at all. If you function or variable names are that long, you might need to split the functionality into smaller parts.
-
Computafreak wrote:
IHaveNeverReallyHadThisProblemBecauseIFindItEasyToBothReadAndWrit
You find that easy to read? :~ As for ease of writing, how many time did you have to press Shift?
-
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 :)
Back in the mainframe days, before PCs were invented, underscores were a standard way of making long identifiers readable. As people have observed, it's slightly more effort to type, but code is only written once and read many times. More effort and expense per line of code is expended in maintenance than initially creating it, so if it makes your code more readable it may be worth it.
-
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 :)
-
GetMyPreciousDataFromAnXMLFile() get_my_precious_data_from_an_XML_file() Either way that's a LOT of typing wouldn't this be better: Gmpdff() ?
grgran wrote:
wouldn't this be better: Gmpdff()
Nah - you still need to hit the Shift key. Maybe: gmpdff()
-
grgran wrote:
wouldn't this be better: Gmpdff()
Nah - you still need to hit the Shift key. Maybe: gmpdff()
-
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 :)
Actually as a JS coder I preffer that naming:
//Get My Precious Data From An XML File
gmpdfaxmlf();Publish the code without comments :) And make sure you keep copy of it with comments! :P
-
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 used Camel Case because it is easy to read. I hate reaching for the underscore anyhow. Give me the main three rows of keys for ease of typing. Anyhow it is part of the accepted coding conditions for VB programming.
-
Where I work we use both at the same time, so everyone is offended :) CamelCaseForClassAndTypeNames underscores_for_variable_and_method_names
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 :)
-
I have always used Camel Case because it is easy to read. I hate reaching for the underscore anyhow. Give me the main three rows of keys for ease of typing. Anyhow it is part of the accepted coding conditions for VB programming.
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 :)
-
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
Agreed. I'll manage either way but I prefer keeping a single symbol (variable/method name) easily discernable unlike:
unfortunately_wrong_because = this_symbol - looks_a_lot_like - this-symbol;
-
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 :)
To the OP: agreed, in general. But for small variable names, camelCasing is definitely easier and doesn't exact too harsh a reading penalty. The difficulty in reading grows with each word added, so if you can keep your names to two-three individual components, you should be all right. By contrast, sticking in a bunch of underscores can seriously extend the length of a variable name, which I begin to find just about as onerous as reading scrunched names. So, my advice is to use underscores if you really need them, but be as sparing as possible. (Hint: they do make a great way to abbreviate certain groups, such as "to", "of the", and other article conglomerations.)
-
...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.)