4 ms·
Nice charts. I'd be curious about number of spaces, particularly for JS: 2 spaces seems more common in the Node community, but I see a lot of 4 as well. Perhaps
by graue 13y ago
Nice charts. I'd be curious about number of spaces, particularly for JS: 2 spaces seems more common in the Node community, but I see a lot of 4 as well. Perhaps it has to do with whether the author is more comfortable with Ruby (usually 2) or Python (4).
My current company goes against the grain by using snake_case instead of camelCase in JavaScript code. It weirded me out at first, but considering our backend is Python, it's nice not to switch conventions.
- rcsorensen 13y agoI've come to really enjoy using the conventions of the language to keep things clear when writing css-rules that are intermixed with javaScriptVariables talking to a ruby_backend emitting jsonEncodedObjects. Keeping things js-named helps keep my mind in the path of JavaScript conventions instead of Ruby ones in situations like array_of_things.pop and arrayOfThings.pop()
- graue 13y agoYeah, that's true too. Just looking at the positive side of a convention that's not mine to change :)
- shortstuffsushi 13y agoYeah, I completely agree. It starts to get a bit confusing when you have a BackEndInCSharp that goes through a javaWebServer before reaching iOS. We tend to have a hard time being consistent once we get to iOS, but that's due also to the fact that we've just merged three different teams (each without a specific standard...)
- casual_slacker 13y agoDojo and jquery use tabs. Nodejs and Google Closure use 2 spaces @see http://code.jquery.com/jquery-1.10.1.js http://code.jquery.com/jquery-1.10.1.js https://github.com/joyent/node/blob/master/src/node.js https://github.com/joyent/node/blob/master/src/node.js https://code.google.com/p/closure-library/source/browse/closure/goog/dom/dom.js https://code.google.com/p/closure-library/source/browse/clos...
- glitchdout 13y agoDouglas Crockford conventioned 4 spaces for indentation so that's what I do. http://javascript.crockford.com/code.html http://javascript.crockford.com/code.html