I guess I could be ignorant here, but I don't really feel that Coffeescript makes things easier/more elegant/better than just using jQuery. I'm not particularly a fan of abstracting abstractions in the first place so I'm probably biased, but I find jQuery to be clean and concise already. An example from the article:
All coffeescript really did there was remove the commas and subtly change the syntax. That's not an improvement at all, it's just a lateral syntax change. If anything, the lack of commas almost makes it harder to read.
Why change to coffeescript and add another step (compilation of coffeescripts) into the mix when jquery was already pretty good to start with? Just seems like its something that would make it hard to take on new coders when your business starts scaling because they would need to know yet another meta-abstraction.
What I really dislike about this is the use of curly braces to denote two completely different things: an object literal, and a function. Functions are extraordinarily privileged entities in JavaScript; they're the only way of creating scope, and they also change the context (`this`). Object are just a bunch of key-value pairs.
So to me, JavaScript's semantics are much clearer through the lens of CoffeeScript semantics: Curly braces are only used for object literals, and functions are denoted by a distinct symbol followed by indentation, except in one-liners like the above.
The extra compilation can be annoying (through largely transparent thanks to tools like Barista and the upcoming Rails 3.1 integration), but for me, it's always felt worth it. Debugging is harder, true, but I write code with fewer bugs in the first place. On net, learning CoffeeScript has been both a pleasure and a productivity boost.
Comments
I guess I could be ignorant here, but I don't really feel that Coffeescript makes things easier/more elegant/better than just using jQuery. I'm not particularly a fan of abstracting abstractions in the first place so I'm probably biased, but I find jQuery to be clean and concise already. An example from the article:
$.post(
)All coffeescript really did there was remove the commas and subtly change the syntax. That's not an improvement at all, it's just a lateral syntax change. If anything, the lack of commas almost makes it harder to read.
Why change to coffeescript and add another step (compilation of coffeescripts) into the mix when jquery was already pretty good to start with? Just seems like its something that would make it hard to take on new coders when your business starts scaling because they would need to know yet another meta-abstraction.
[Obviously I'm biased because I have a book to sell, but...]
I'd call the gains "small but significant" in that case. The corresponding JS would be
What I really dislike about this is the use of curly braces to denote two completely different things: an object literal, and a function. Functions are extraordinarily privileged entities in JavaScript; they're the only way of creating scope, and they also change the context (`this`). Object are just a bunch of key-value pairs.So to me, JavaScript's semantics are much clearer through the lens of CoffeeScript semantics: Curly braces are only used for object literals, and functions are denoted by a distinct symbol followed by indentation, except in one-liners like the above.
The extra compilation can be annoying (through largely transparent thanks to tools like Barista and the upcoming Rails 3.1 integration), but for me, it's always felt worth it. Debugging is harder, true, but I write code with fewer bugs in the first place. On net, learning CoffeeScript has been both a pleasure and a productivity boost.