Scenario: a magical fairy—the “magical” is important, so you don’t confuse it with a boring non-magical fairy—appears and grants me one wish. What would I wish for?
That JavaScript switches to snake_case
over night. We wake up and all the camelCase
is gone, replaced by beautiful snake_case
.
This isn’t a matter of personal taste. camelCase
is simply more difficult to read. It requires more visual effort. There’s even a study on that.
We’re used to reading words that are visually separated, and the underscore provides that visual separation. You probably had no issues reading this sentence, even though it was mostly lowercase letters. But writingLikeThis madeItLikely aBitMoreDifficult toRead, didn’t it?
JavaScript is not a visually appealing language. Perhaps Java and Smalltalk were not the best influences. And with all the new question marks added to its syntax, it looks like a very insecure “mocking spongebob” meme.
And I won’t buy the argument that camelCase
is more efficient because you don’t have to type the underscore all the time! It’s as if developers spend their whole day just typing, non-stop, without autocomplete, constantly having to find those keys to press! Aaaaah help, where’s my underscore key gone now, I can’t find it!!!
Nah. snake_case would have been the better choice.
A man can dream though… a man can dream.