Archive for the ‘Coffeescript’ category

Should I write in CoffeeScript instead of Javascript?

August 8th, 2012

I have been writing a lot of javascript at my current job lately because we have been working on a single page client app that is heavy on the client, thus the need for javascript. Here lately the buzz is all about CoffeeScript and how its just the greatest thing since sliced bread for Javascript developers. I have inserted an image below that basically shows the difference in js (Javascript) vs. cs (CoffeeScript).


As you can see, CoffeeScript is a lot less wordy, but is that a good thing?  Is it good to remove all the wordiness in favor of some whitespace?  I think there is an argument for both honestly and this video is a pretty impressive example of how much code you can reduce if you use coffeescript: http://ryanflorence.com/2012/javascript-coffeescript-rewrite/.  I think what it truly boils down to is your staff, if your whole staff can agree on using coffeescript then I say go for it.

There is also the argument that if you just write coffeescript you lose the ability to understand javascript cause you are letting CS do all the work for you, which may be a decent argument but not as strong as keeping your developers on the same codebase.  I work in a predominantly C# house, we wouldn’t hear of mixing VB.net into that picture, it would cause a lot of confusion amongst developers, especially when it come time to fix bugs.  I hope I have confused you as much as I have myself, lol, I would love to hear arguments for/against the use of Coffeescript, the code-reductions it provides definitely has my head turning.