Note: I actually rather like Matador. I just find this particular style--high density, no semicolons--much harder on my eyes. I'm sure many others can read it better than I can, however.
Leaving aside the global variable, I think this example's biggest issue is the complete lack of whitespace and the big stack of chained calls (which I'm not personally a fan of, but your house, your rules :)) - this is it with a few reader-sympathetic newlines added: https://gist.github.com/1710254
Personally, I find using comma-first and omitting semicolons except where required for ASI reduces the amount of noise down the right-hand side of the code and the amount of scanning I have to do there (for variable definition, object literals and nested calls in particular).
> Leaving aside the global variable, I think this example's biggest issue is the complete lack of whitespace and the big stack of chained calls (which I'm not personally a fan of, but your house, your rules :))
IMO, the whitespace isn't so much an issue as the chained calls. Once you exceed about 5-8 lines of method chaining where your eyes now have some difficulty lining up the indentation (although Sublime really helps in this regard), the lack of visible line terminators can be somewhat obnoxious to someone who comes from a background of C/C-inspired languages.
I agree with Isaac's assertions that it's important to understand line terminating, and I also agree with his other statements regarding pants. I prefer to wear pants unless I'm hanging out in my Python room. It's just easier on my eyes.
I am used to looking for punctuation on the right hand side because I am a native reader of the English language. So, I don't think I've ever had to exert myself or do any extra scanning to see right-hand side punctuation in Javascript or English.
Commas first cause more noise on the left side; they distract me because I'm used to reading English and I'm used to reading code that's written in English based programming languages where people generally agree that punctuation belongs on the right side.
Honestly though, I care more about comments than coding style, something that the Joyent guys don't seem too fond of despite the complexity of the Node.js code. I just don't get it.
Comments
Sorry to be negative, but I hope this doesn't mean that we're going to start seeing more of node's code in the npm style.
I hope not.
Edit: I don't know of too many prominent JavaScript programmers who prefer not to use semicolons. http://dailyjs.com/2012/01/12/style/
One of the better arguments I can think up against the npm coding style is probably found in the Matador framework, specifically its router: https://github.com/Obvious/matador/blob/master/src/router.js
Note: I actually rather like Matador. I just find this particular style--high density, no semicolons--much harder on my eyes. I'm sure many others can read it better than I can, however.
Leaving aside the global variable, I think this example's biggest issue is the complete lack of whitespace and the big stack of chained calls (which I'm not personally a fan of, but your house, your rules :)) - this is it with a few reader-sympathetic newlines added: https://gist.github.com/1710254
Personally, I find using comma-first and omitting semicolons except where required for ASI reduces the amount of noise down the right-hand side of the code and the amount of scanning I have to do there (for variable definition, object literals and nested calls in particular).
> Leaving aside the global variable, I think this example's biggest issue is the complete lack of whitespace and the big stack of chained calls (which I'm not personally a fan of, but your house, your rules :))
IMO, the whitespace isn't so much an issue as the chained calls. Once you exceed about 5-8 lines of method chaining where your eyes now have some difficulty lining up the indentation (although Sublime really helps in this regard), the lack of visible line terminators can be somewhat obnoxious to someone who comes from a background of C/C-inspired languages.
I agree with Isaac's assertions that it's important to understand line terminating, and I also agree with his other statements regarding pants. I prefer to wear pants unless I'm hanging out in my Python room. It's just easier on my eyes.
I am used to looking for punctuation on the right hand side because I am a native reader of the English language. So, I don't think I've ever had to exert myself or do any extra scanning to see right-hand side punctuation in Javascript or English.
Commas first cause more noise on the left side; they distract me because I'm used to reading English and I'm used to reading code that's written in English based programming languages where people generally agree that punctuation belongs on the right side.
Honestly though, I care more about comments than coding style, something that the Joyent guys don't seem too fond of despite the complexity of the Node.js code. I just don't get it.
Node.js and npm use different JS styles. They're different programs with different places in their community. That's not changing.