Why underscores might be better than camel case
December 10, 2008
So, the "Ruby way" is to use underscores to delimit most identifiers, e.g. "add_months_to_date", as opposed to the Java camel-case way of "addMonthsToDate". This was initially something that irked me about Ruby, mostly because typing an underscore is kindof a pain (shift with the left hand and pinky with the other).
Now that I've started working, I've been reading a lot of code and realizing that code is more often read than written. Ultimately, camel case is a just lot harder to read (especially if you create meaningful method names like myself and my co-workers seem to do).
It's pretty hard to defend: as more readable than: The underscores are like spaces, making the identifier a lot more readable. Of course, both are more readable than:
This would never fly with Java (and, honestly, look a bit weird), but I'm no longer gonna curse the Ruby convention.