the right time to use coffeescript

coffeescript, javascript, ruby-on-rails

Solution

You should understand what problems Coffeescript is supposed to solve. And for that, you should have a basic knowledge of javascripts' "bad parts". I suggest reading Douglas Crawford about that (there's a book, but also a lot of resorces on internet. Just google "javascript bad parts"). Basically, the idea is that "Underneath all those awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way." (taken from coffeescript's site).

There's a tool to assist programmers to avoid javascript pitfalls called jslint. This tool analizes your code and gives warnings about common mistakes, such as global variables, semicolon insertions, namespace pollution, etc...

Coffeescript translates to javascript. But the javascript it generates is a cannocical subset, highly compliant with jslint. What's more, it generates javascript code valid on all browsers. So it is not just a nice syntactic sugar layer, it really helps generate solid code.

Problem

So basically I have a number of concerns holding me back from coffeescript: I'm not really an expert in js yet, even though I'm using it for around 3 years now I still feel like I'm missing something important about it. Since it's mostly a supportive technology for me I never find time to go in depths of js ( which, I admit, might be a wrong attitude ). My js knowledge will get even worse if I'll start Using coffeescript I'm not sure if I can actually trust coffescript, meaning the js code it compiles to At times I don't understand the js code coffeescript compiles to and even worse - why it compiles like that. I'd like to know your thoughts on the above points. The crucial one is: How using coffeescript affected your knowledge of js? And how important you think it is to fully understand js before switching to coffeescript?

Original source