Live data from Hacker News

CamelCase vs. underscores: Scientific showdown

whathecode.wordpress.com

31–40 of 60 posts

Re: CamelCase vs. underscores: Scientific showdown

#31

I 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.

Re: CamelCase vs. underscores: Scientific showdown

#36
Underscores 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; it's fun, isn't it?

// BTW: I don't believe anyone telling me they can read camels more efficiently. Underscores add contrast, which aids your vision quite a bit.

Re: CamelCase vs. underscores: Scientific showdown

#38

I 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…

If it's really a problem, couldn't you map maybe shift-space to underscore?

Re: CamelCase vs. underscores: Scientific showdown

#39

Try choosing independently of (language) convention, habit or type of the identifiers. That'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.

What if you're inventing a new language and need to set the convention?

Re: CamelCase vs. underscores: Scientific showdown

#40
When I am writing C, I tend to use underscore. I think I just follow the convention, or the code that already exists. Imagine the some part of the code written in camelCase and other used underscore.

//This wont look good :)

int static set_my_config(char* data);

int static getMyConfig();

Post reply on HN