4 ms·
I love CoffeeScript. But then, I am well-versed in JavaScript. People who don't understand scope, lambdas, prototypes, etc. should stick to JavaScript, as Cof
by mratzloff 14y ago
I love CoffeeScript. But then, I am well-versed in JavaScript. People who don't understand scope, lambdas, prototypes, etc. should stick to JavaScript, as CoffeeScript obscures some of that. You really should understand what's going on behind the scenes.
Which makes it all the stranger that experienced JavaScript developers seem to avoid it, while less experienced ones embrace it.
My main gripe with CoffeeScript (there are a couple, but here's one) is code organization/readability when a method takes multiple functions as arguments.
foo ->
bar()
baz()
quux()
, (error) ->
throw error if error
That does look a bit odd, and you run into these a lot when you're using caolan/async. You can avoid this by avoiding anonymous methods, but with so many callbacks in Node.js that is probably less readable.
- roh26it 14y agoNodejs and Coffee are surely a nightmare. I've tried using async to improve code readability but it still doesn't fit well with coffee.
- schwabacher 14y agoI agree that function calls like that can get weird in coffee - I like to write them like this, which i think turns out to be a little more readable: foo( -> bar() baz() quux() (error) -> throw error if error )
- svachalek 14y agoYou can assign the functions to variables and then make the function call in one line. Adds one line of code and a lot of readability.
- mratzloff 14y agoYes, but please see my last sentence. With so many callbacks in Node.js, it can make it just as difficult to follow.