People ask time and again, and here again: do we really get more productive by saving curlies and semicolons? Really?<p>YES:<p>It's not the time saved while <i>writing</i> the code that matters here -- although I do believe it adds up quickly if you work on a project that might occupy you for months or years and have invested the initial week of getting fully into CoffeeScript mode.<p>NO, it's the time saved <i>reading</i> your code time and again as you revisit your code-base over these months or years of refining your project going forward.<p>CoffeeScript's "easier writability" may be debatable, but it's its "easier readability" where it really shines. I can glance quickly at my way-fewer-lines of CoffeeScript and parse it much more smoothly than I ever could a curly C-style language. Maybe it's because I first started out in, boohoo, BASIC. But indented lines with no superfluous { syntax; decorators } just flow into my brain much faster.<p>If you're a fire-and-forget coder who writes line after faultless bugless line that you never need to revisit, review or simply recall and still get a meaningful composition of a program, app or site that isn't just a house of cards built on quick-sand or a simple batch job at the end of the day -- I envy you! In my case, 99% of my classes and functions are an API to each other. So I look up how the stuff I wrote days, weeks or months ago was supposed to be called or initialized constantly. I read my code more often than I write it.<p>I like writing CoffeeScript but what matters is -- I love reading it. Before, I liked writing JavaScript -- but I hated reading it.
Quick point of clarification. The post says:<p><pre><code> > As it turns out that isn’t entirely true since coffeescript
> is a class based object oriented language and javascript is
> prototype based. This was actually a mark against
> coffeescript for me since part of my desire to learn
> javascript was to dally in prototype based OOP.
</code></pre>
CoffeeScript is prototype based to the precise same extent that JavaScript is. The "class" keyword is just sugar for JavaScript's constructor function + prototype chain combination. To mangle Shakespeare:<p>What's in a name? That which we call a class by any other name would smell as sweet.<p>Call it a prototype if you like -- it's the same thing in code.
Do semicolons really distract people from thinking about the behaviour of their code? Really? Would these people like their novels and articles decompiled so that every sentence is on a new line, and thus periods wouldn't distract them so much from the meaning of the text? Or is it just transparent after a while, as the way you end something?
I'll use anything that fixes the way javascript handles scoping. Take this gem, for example:<p><html>
<body>
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
</ul>
</body><p><script type="text/javascript">
els = document.getElementsByTagName('li');
for(i=0; i < els.length; i++){
els[i].addEventListener('click', function(){alert(i);}, false);
}
</script>
</html>
CoffeeScript has some nice benefits but in my opinion not having to deal close curly braces or add semi colons hardly qualifies as a reason to use one language over another.
Though I love CoffeeScript, I feel it's very important to understand how JavaScript works. It's a great language, but only if you understand what is going on, and why you do have to use hasOwnProperty.
Personally, I really like the whole coffeescript/sass/haml trio. (I really don't like SCSS).<p>It drastically reduces the amount of errors in your code, at the expense of a syntax that's a little different.