CamelCase vs. underscores: Scientific showdown
whathecode.wordpress.com
CamelCase vs. underscores: Scientific showdown
1–10 of 60 posts
Re: CamelCase vs. underscores: Scientific showdown
#2> Camel case is easier to type, and underscores are hard to type.
I'll grant it that, but in the context of programming, this does not seem to be a "pro". After all, don't we spend far more time reading code than we do writing code?
I'm old, but I'm still surprised at how I have to fight over my reluctance to do something in another language (such as Python) when I remember that it's conventionally camelCase...on the other hand, I try to use it as a personal advantage...I can immediately tell in a body of code what helper functions originated from me, as I'll habitually write them in underscore (though this probably annoys the shit out of anyone who then tries to read/use my code).
Conversely, my enthusiasm for using R jumped when I read Hadley Wickham's style guide and saw that he endorsed underscores (http://r-pkgs.had.co.nz/style.html)
Re: CamelCase vs. underscores: Scientific showdown
#3- CamelCase 52.34% (4,493 votes)
- underscores 47.66% (4,092 votes)
Which kind of says it all. Use whatever style you want, stop worrying so much about what other people are doing. Variable names a far more important than the formatting you use with them.
Re: CamelCase vs. underscores: Scientific showdown
#4Re: CamelCase vs. underscores: Scientific showdown
#5Re: CamelCase vs. underscores: Scientific showdown
#6 if(Accounts_Orders_Invoices_Table.Order_Invoice_Number == Order_Invoice_Number){ ...}
if(AccountsOrdersInvoicesTable.OrderInvoiceNumber == OrderInvoiceNumber){ ... }
But I don't really care that much. I'll just do whatever everyone else is doing. At least camcelCase keeps me from reaching for the _ as much and allows me to stay on the A-Za-z more of the time...Re: CamelCase vs. underscores: Scientific showdown
#7That's the non-starter for me right there. I use whatever convention makes sense in the context of what I'm doing. Language, library and previous code in an existing project all dictate my choice in this matter.
Re: CamelCase vs. underscores: Scientific showdown
#8As long as you follow convention, that's all that matters.
Re: CamelCase vs. underscores: Scientific showdown
#9From the OP's list of "Pro CamelCase": > Camel case is easier to type, and underscores are hard to type. I'll grant it that, but in the context of programming, this does not seem to be a "pro". After all, don't we spend far more time reading code than we do writing code? I'm old, but I'm still surprised at how I have to fight over my reluctance to do something in another language (such as Python) when I remember that…
According to pep8 "Function names should be lowercase, with words separated by underscores as necessary to improve readability. mixedCase is allowed only in contexts where that's already the prevailing style"
Re: CamelCase vs. underscores: Scientific showdown
#10 if ( thisLooksLikeJavaOrJavaScriptOr/* ... */ )
{
youLikeCamelCase = true;
votePoll( camelCaseFormatting );
}
else if ( this_looks_like_python )
{
you_like_underscores = true;
vote_poll( underscore_formatting );
}
Variable assignments for this particular piece of code: thisLooksLikeJavaOrJavaScriptOr/* ... */ = true;
this_looks_like_python = false;