4 ms·
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
by Someone1234 12y ago
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 least camcelCase keeps me from reaching for the _ as much and allows me to stay on the A-Za-z more of the time...
- kbenson 12y agoIn my preferred language, CamelCase is often used to class names, and underscores for function/method names (as mentioned as in the article). Then again, my preferred language uses sigils so I don't need to rely on convention to differentiate things as much as some other languages.
- kbd 12y ago> At least camcelCase keeps me from reaching for the _ as much... Among the many reasons I prefer Dvorak is that dash/underscore is on the home row.
- deleted 12y ago[deleted]
- hga 12y agoAgreed, 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.
- amyjess 12y agoPersonally, I'm fond of Algol style, where spaces are permitted in identifiers. Man, Algol 68 was really ahead of its time... too bad it never caught on.
- dubya 12y agoIf it's really a problem, couldn't you map maybe shift-space to underscore?
- rejected_value 12y agoYour first example is actually a mutant hybrid of camel-cased underscores. 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.
- Someone1234 12y agoFair point. That was more my laziness in creating the fictional example (I just added the _ to the camelCase).