4 ms·
I'm puzzled about the switch from camelCase to snake_case for JS as shown in http://foundation.zurb.com/docs/upgrading.html#javascript-variable-changes http://f
by chrismorgan 13y ago
I'm puzzled about the switch from camelCase to snake_case for JS as shown in http://foundation.zurb.com/docs/upgrading.html#javascript-variable-changes http://foundation.zurb.com/docs/upgrading.html#javascript-va.... The clear convention in JavaScript is camelCase, why switch away from it? (I say this as someone who in normal life using Python and Rust uses and prefers snake_case but who uses camelCase when writing JavaScript.)
- Spiritus 13y agoI wouldn't mind if more projects did this to be honest.
- lowboy 13y agoI would, just because it causes fragmentation. PEP-8[0] is a big win for Python. Javascript relies on adhoc standards and best practice docs from respected entities. I'm open to change and debate, but it should be approached carefully. [0]: http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/
- jessedhillon 13y agoTo be fair, at the time JS was developed, there was a body of well-documented knowledge involving camelCasing. First and foremost was, of course, Java. There are various RFCs involving LDAP schemas as well -- I recall seeing a hilarious document once describing how to properly name the attribute corresponding to an entity's certificate: cACertificate* Talk about slavish consistency.
- Segmentation 13y ago> The clear convention in JavaScript is camelCase, why switch away from it? Citation?
- lowboy 13y agoJavascript was created in camelCase, and most major open source projects I've used have been camelCase. I can't find any data on it, but it fits with my experience for what that's worth.
- jessedhillon 13y agoHow would you even expect this to be cited? Seriously, does someone need to crawl every Javascript project on Github and compile statistics on naming styles before they can make an obviously true statement like this? The fact that camelCase is the norm in the language and browser environment is obvious to anyone who has written even a modest amount of JS. notQuantified != false
- cstigler 13y agonotQuantified !== false to avoid type coercion here
- mendelk 13y agoS/he was using CoffeeScript, obviously! :)
- madeofpalk 13y ago> crawl every Javascript project on Github and compile statistics on naming styles You mean... like this? http://sideeffect.kr/popularconvention/#javascript http://sideeffect.kr/popularconvention/#javascript Unfortuantely there's no stat there for camelCase for Javascript.
- chrisfarms 13y agoLet's just try some searches for some common names using github code search with a ".js" extension filter hideImage vs hide_image: 424 vs 50 toggleItem vs toggle_item: 1022 vs 52 clickElement vs click_element: 3469 vs 368 Coding conventions by statistics :) https://github.com/search?q=searchPage+extension%3Ajs&type=Code&ref=searchresults https://github.com/search?q=searchPage+extension%3Ajs&type=C...
- deleted 13y ago[deleted]
- avolcano 13y agoThis is insane. I have literally never seen a large-scale open source project or JS style guide that uses snake_case. The DOM is camelCase. jQuery is camelCase. Node APIs are camelCase. Why on earth do Zurb think their library is any different?
- jimmytucson 13y agoMeteor did, at least in the beginning.
- __david__ 13y ago> This is insane. Really? Why on earth would you care? What if they were to indent their code with 3 spaces? Would that be "insane", too? What if they don't like putting in unnecessary braces around one line "if" statements? Insane? It's a (very common) stylistic choice. It's hardly insane.
- avolcano 13y agoIt's a public API meant for consumption by other developers, 95-99% of which are going to be use camelCase. I don't care what their code looks like internally. I do care about the public interface to it.
- jakethehuman 13y ago>What if they were to indent their code with 3 spaces? Whoa there buddy! Put the gun down...
- jakethehuman 13y ago>What if they were to indent their code with 3 spaces? Whoa buddy! Put down the gun... On a serious note... is this trolling or are people seriously complaining about camel-case vs snake-case?
- jakethehuman 13y ago>What if they were to indent their code with 3 spaces? Whoa buddy! Put down the gun... On a serious note... is this trolling or are people seriously complaining about camel-case vs snake-case?
- camus2 13y agoWhile I hate camelCase, i have to agree, javascript core lib uses camelCase and PascalCase , so should 3rd party libraries.
- smrtinsert 13y agoWhat has this site come to...