3 ms·
I'm biased, insofar as I'm the author of the CoffeeScript book published by PragProg (http://pragprog.com/titles/tbcoffee/coffeescript http://pragprog.com/title
by TrevorBurnham 15y ago
I'm biased, insofar as I'm the author of the CoffeeScript book published by PragProg (http://pragprog.com/titles/tbcoffee/coffeescript http://pragprog.com/titles/tbcoffee/coffeescript), but I'd say "yes, with slight reservations."
If your team consists of three John Resig-like JS ninjas, then the benefits of using CoffeeScript may be slight, or even cancelled out entirely by the extra step of compilation or the concern that future versions of CoffeeScript may break your code. But if your JS skills are beginner-to-intermediate, then I'm quite confident that you'll be more productive after a week or two of using CoffeeScript. That's based on my own experience, and the experience of many developers I've talked to.
CoffeeScript is an improvement in a lot of ways, and makes some of the most common JS mistakes (polluting the global scope by omitting `var`, relying on `==` to coerce types) impossible, while making many (`this` not being what you want it to be) easier to fix. Brendan Eich, the creator of JavaScript, is on record as being a fan.
It's not a magic bullet, and there are certainly tradeoffs, but all in all, I'm of the opinion that CoffeeScript is what most devs should be using. And the benefits are especially pronounced in a team setting, where having shorter, more readable, more modularized code makes communication much, much easier. In pg's words: "Succinctness is power."
(By the way, I've also waxed about this subject at the Programmers Stack Exchange: See http://programmers.stackexchange.com/questions/72569/what-are-the-pros-and-cons-of-coffeescript/ http://programmers.stackexchange.com/questions/72569/what-ar... and http://programmers.stackexchange.com/questions/72699/should-i-invest-time-learning-coffeescript. http://programmers.stackexchange.com/questions/72699/should-...)