
Ask HN: Why is camel case a standard in JavaScript ? - maxencecornet
Hello,<p>I&#x27;ve always wondered how camel case became a standard, rather than any other convention ?<p>In my opinion, Snake case is much more readable.
======
mtmail
And other people think camel case is more readable. It's a classic flamewar
topic which regardless how many arguments are exchanged won't find a common
ground.

------
brudgers
I suspect that it goes back to the days of yore when JavaScript was associated
with Java and the orientation of the Java community toward camelCase [it's now
the Java convention:
[http://www.oracle.com/technetwork/java/codeconventions-13509...](http://www.oracle.com/technetwork/java/codeconventions-135099.html)]

I suspect that the reason Java tended toward camelCase is that camelCase was
emerging from research at about the time Java was released into the wild and
it came along for the ride. Even wilder speculation is that camelCase rose out
of Hungarian notation which was among 'best practices' preceding Java's
release and Hungarian notation uses lower case prefixes on capitalized
descriptions.

Three levels of speculation is as far as I will go.

------
jeanlucas
camelCase and PascalCase, right? Maybe it comes from the language name (python
-> snake, JavaScript -> PascalCase) :-P

Now being serious: Actually it is _not_ a standard, since it is not defined
like PEP8 kinda defines[1]. Then it goes by what the community uses. From what
I've seen, most projects use the camelCase/PascalCase, but some like
Foundation switched to underscores[2]. There's no reason why one is better
than the other in terms of readability.

On a more serious note: A study[3] suggests that "camel casing leads to higher
accuracy among all subjects regardless of training, and those trained in camel
casing are able to recognize identifiers in the camel case style faster than
identifiers in the underscore style." There's a discussion in this blog post:
[4].

IMO it's too immature to be attached to a style, like it is too immature to
think you're better than other developers because you use vim.

\--

[1]: [https://www.python.org/dev/peps/pep-0008/#naming-
conventions](https://www.python.org/dev/peps/pep-0008/#naming-conventions)

[2]:
[http://foundation.zurb.com/sites/docs/v/5.5.3/upgrading.html...](http://foundation.zurb.com/sites/docs/v/5.5.3/upgrading.html#javascript-
variable-changes)

[3]:
[http://www.cs.loyola.edu/~binkley/papers/icpc09-clouds.pdf](http://www.cs.loyola.edu/~binkley/papers/icpc09-clouds.pdf)

[4]: [https://whathecode.wordpress.com/2011/02/10/camelcase-vs-
und...](https://whathecode.wordpress.com/2011/02/10/camelcase-vs-underscores-
scientific-showdown/)

