We’ve started to use CoffeeScript in our product – a non-public facing website which is basically an app for browsing certain kinds of data.
We use CoffeeScript as a command-line compiler (not on the server, which we’d eventually like to do).
PROS (for us):
- It gets rid of a lot of needless clutter in javascript (eg braces, semi-colons, some brackets) to the extent that the code is cleaner & easier to comprehend at-a-glance than javascript
- 20-30% less lines of code than javascript (to do exactly the same thing)
- CoffeeScript not only removes noise but adds keywords, classes, and features like heredocs to make coding cleaner and somewhat more enjoyable
- Given the previous points, it is undoubtedly faster to code in CoffeeScript once you learn the ropes
CONS
- When using the command-line compiler: to debug, you’re looking at different code when solving the problem (javascript) as when writing the fix (coffeescript). However, somewhat unbelievably, our CoffeeScript is so awesome we’ve never needed to debug it!
Importantly, we can turn back at anytime. Our coffeescript compiler is just producing readable javascript, so if anyone changes their mind or can’t figure something out, then we can just drop back to using the javascript that coffeescript produced – and keep coding.