CamelCase naming convention
-
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 :)
Nemanja Trifunovic wrote:
getmypreciousdatafromanXMLfile()
You are really cunning. :laugh: That's not a camel, that's a snake with a big ass. A real camel would look something like this:
getMyPreciousDataFromAnXMLFile
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
-
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_the_hell_is_XML_always_capitalized?
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
-
Jim (SS) wrote:
"Real programmers can write Fortran in any language". Unknown
Real programmers spell it
FORTRAN
like God, IBM, and other TLA's intended.Software Zen:
delete this;
Huh? I thought it was ForTran. :confused:
-
why_the_hell_is_XML_always_capitalized?
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
Capitalized? No. Leveraged? Yes. :-D
-
I can almost see you sitting in front of your computer, Rama, hunched over ... coveting your code ... whispering ... It is ... My Precious ... :rolleyes:
That was a typo. here is the actual code.
[myPrecious loadDataFromXML];
-
Gary Wheeler wrote:
spell it FORTRAN
I was wondering how many other people even knew that. Even C# and Java still allow GOTOs, so the statement is still true.:cool:
SS => Qualified in Submarines "We sleep soundly in our beds because rough men stand ready in the night to visit violence on those who would do us harm". Winston Churchill "Real programmers can write FORTRAN in any language". Unknown
Much better.
Software Zen:
delete this;
-
Huh? I thought it was ForTran. :confused:
Software Zen:
delete this;
-
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 :)
Put on smart-ass hat
Nemanja Trifunovic wrote:
GetMyPreciousDataFromAnXMLFile()
This is known as Pascal-case. Camel case version would have a small "g" at the beginning. Take off smart-ass hat
-
Things like these are a matter of personal preference. Talking about code formatting, I call people who do this a rogue:
void MyMagicFunc(LPVOID pParams){
if(!pParams){
HandleError();
}//stuff goes here
}I much prefer this instead:
void MyMagicFunc(LPVOID pParams)
{
if(!pParams)
{
HandleError();
}//stuff goes here
}But, I'm well prepared to be called a rogue by those who don't like my style, as everyone may not like the same way of doing things. :) [ADDED] Just noticed the camel casing in my post. [/ADDED]
It is a crappy thing, but it's life -^ Carlo Pallini
I agree, but prefer
void MyMagicFunc(LPVOID pParams)
{
if(!pParams)
{
HandleError();
}
//stuff goes here
}Dunno why, been using it since I started with C (so it was probably a company style thing at the time). Either way, it is a lot clearer how the brackets match up.
-
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 :)
No Camelcase, no Pascal, no undescores, no hyphen. Method names should be like
foo(
) orgoo()
(names likesend()
andrecv()
, deprecated, are allowed only if you're in a poetic mood). :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Put on smart-ass hat
Nemanja Trifunovic wrote:
GetMyPreciousDataFromAnXMLFile()
This is known as Pascal-case. Camel case version would have a small "g" at the beginning. Take off smart-ass hat
And for the third time in this thread: depends whom you ask[^].
-
why_the_hell_is_XML_always_capitalized?
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]
-
DunnoIAlwaysDoThisWhenPuttingXmlInACamelCaseString
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
-
Brady Kelly wrote:
That is actually Pascal Case. thisIsCamelCase.
Depends whom you ask[^]. I consider Pascal case to be a variant of camel case.
After 5 years in university 15 years in the business, Pascal- and camel-case have always be the same.
-
That was a typo. here is the actual code.
[myPrecious loadDataFromXML];
Does that conform to the LOTR Design Pattern? ;)
-
Things like these are a matter of personal preference. Talking about code formatting, I call people who do this a rogue:
void MyMagicFunc(LPVOID pParams){
if(!pParams){
HandleError();
}//stuff goes here
}I much prefer this instead:
void MyMagicFunc(LPVOID pParams)
{
if(!pParams)
{
HandleError();
}//stuff goes here
}But, I'm well prepared to be called a rogue by those who don't like my style, as everyone may not like the same way of doing things. :) [ADDED] Just noticed the camel casing in my post. [/ADDED]
It is a crappy thing, but it's life -^ Carlo Pallini
Rajesh R Subramanian wrote:
void MyMagicFunc(LPVOID pParams){ if(!pParams){ HandleError(); } //stuff goes here }
void fun(void *p)
{
if (!p)
{
cry();
}
/* stuff */
}fixed. :laugh:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Things like these are a matter of personal preference. Talking about code formatting, I call people who do this a rogue:
void MyMagicFunc(LPVOID pParams){
if(!pParams){
HandleError();
}//stuff goes here
}I much prefer this instead:
void MyMagicFunc(LPVOID pParams)
{
if(!pParams)
{
HandleError();
}//stuff goes here
}But, I'm well prepared to be called a rogue by those who don't like my style, as everyone may not like the same way of doing things. :) [ADDED] Just noticed the camel casing in my post. [/ADDED]
It is a crappy thing, but it's life -^ Carlo Pallini
I only ever use
!
on a true boolean value and always useNULL
when checking pointers. :) I find it easier to read, especially as I dumped Hungarian notation years ago:if (foo == NULL)
{
// I know 'foo' is a pointer
}if (!bar)
{
// I know 'bar' is a bool
}Each to their own.
-
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 :)
Personally I prefer camel / Pascal case generally, ut reserve the use of the underscore for punctuation.. e.g. I might have Patient_Doctor which contains the many-many links between patients and doctors, and separates it from PatientDoctor which would be a collection of doctors who are easy-going.
___________________________________________ .\\axxx (That's an 'M')
-
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 only ever use
!
on a true boolean value and always useNULL
when checking pointers. :) I find it easier to read, especially as I dumped Hungarian notation years ago:if (foo == NULL)
{
// I know 'foo' is a pointer
}if (!bar)
{
// I know 'bar' is a bool
}Each to their own.
Rob Caldecott wrote:
I only ever use ! on a true boolean value and always use NULL when checking pointers.
Nice point. May be I will do it too. :)
It is a crappy thing, but it's life -^ Carlo Pallini