CamelCase vs. underscores: Scientific showdown
41–50 of 60 posts
Re: CamelCase vs. underscores: Scientific showdown
#42Underscores win. Having said that; if your standard lib chose camels, that's probably what you should be choosing too. Consistency is the most important criteria. I personally favour the C-style fuck-it-all naming scheme: else if (like) { likelowbar = true; vote(lowbarfmt); } The narrower the columns, the easier it is for me to comprehend the algorithm. It also makes for great method names. Say "isatty" three times;…
Maybe it's time to accept that other people have different opinions to you, and maybe, just maybe have a preference for camel-casing.
Re: CamelCase vs. underscores: Scientific showdown
#43I have found it very useful to use under_scores as a form of punctuation within camelCase to visually connect related variables.
Like this:
spectrumPlot_x
spectrumPlot_y
spectrumPlot_drawHarmonics
qa_signalDone
qa_setLoadedFlag
requestTimeout_minValue
requestTimeout_maxValue
... and so forth.(Note that the opposite doesn't work: camelCase as a punctuation within under_scores.)
Re: CamelCase vs. underscores: Scientific showdown
#44As of right now the results are as follows: - 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.
I think "use whatever style you want" is a fair ethos for personal projects but the truth is it never works for teams. If organizations allowed that you'd have no conventions and codebases would be a mess for all involved. Years ago I moved from_underscores toCamelCase but I'm not vehemently passionate about it and there are plenty of cases where I need to go back to match_conventions.
Citation needed; my experience is just the opposite (it works much better than trying to specify some kind of organization-wide standard).
Re: CamelCase vs. underscores: Scientific showdown
#45Re: CamelCase vs. underscores: Scientific showdown
#46I really like underscores for two word variable names. It only becomes a problem when you have variable names which are overly long, and your eyes have to move further. 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 l…
Agreed, although I still find '_' to be a lot more clear. Lisps, by not reserving '-', and following convention: (println are-the-clearest-and-easiest-for-me) Also see my other comment.
Man, Algol 68 was really ahead of its time... too bad it never caught on.
Re: CamelCase vs. underscores: Scientific showdown
#471. Is it userID or userId? HTTPClient or HttpClient? Leaving this additional stylistic choice up to people results in conflicting styles even within the scope of "camel case" everywhere! (JavaScript mostly leaves them uppercase, e.g. DOMException...then there's XMLHttpRequest...)
2. Code isn't the only place we need to make this choice: what about configuration files? I find that using camel case for configuration keys – even if the configuration will be the input to a camel-case-language program! – just feels incredibly wrong.
Re: CamelCase vs. underscores: Scientific showdown
#48I really like underscores for two word variable names. It only becomes a problem when you have variable names which are overly long, and your eyes have to move further. 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 l…
Observe:
if(accounts_orders_invoices_table.order_onvoice_number == order_invoice_number){ ...}
Versus yours: if(Accounts_Orders_Invoices_Table.Order_Invoice_Number == Order_Invoice_Number){ ...}
I would be, perhaps, moderately ticked off to have to have to deal with code that looked like that, and used both, in a real world scenario.Re: CamelCase vs. underscores: Scientific showdown
#49country_state_city
or
unitedStates_texas_houston
or
unitedStates_newMexico_santaFe
edit: sorry, don't know HN's markup
Re: CamelCase vs. underscores: Scientific showdown
#50Underscores win. Having said that; if your standard lib chose camels, that's probably what you should be choosing too. Consistency is the most important criteria. I personally favour the C-style fuck-it-all naming scheme: else if (like) { likelowbar = true; vote(lowbarfmt); } The narrower the columns, the easier it is for me to comprehend the algorithm. It also makes for great method names. Say "isatty" three times;…
> // BTW: I don't believe anyone telling me they can read camels more efficiently. Maybe it's time to accept that other people have different opinions to you, and maybe, just maybe have a preference for camel-casing.
I'm glad you used the word "preference." I wish people wouldn't feel the need to justify arbitrary choices they make in life. It's your code and I will honour the choices you made if I ever end up working on it. You can't expect me to drink the Kool-Aid though.