Why the Rampant Fanboyism Around CoffeeScript Worries Me
andrewluetgers.com
andrewluetgers.com
The part of CoffeeScript hate I find most amusing is all the hate for the fact that it's a language that compiles to JavaScript. "The code it generates is bad!" "It's a leaky abstraction!" Well guess what guys, the C compiler that pretty much every piece of code running on your system went through does exactly the same thing, only it generates assembly. Since you don't know assembly (or anything other than how to animate ads with jQuery), you aren't complaining. But it's the same principle and it works well enough. C doesn't expose all of assembly's features. C doesn't always generated optimal assembly code. And yet, we use it anyway, because it's just so much nicer than the "real" underlying language. (And of course, x86 assembly is not what x86 processors run anymore. But that translation takes place in silicon, so you see even less complaining.)
Complain about actual problems, not about what you can see. If all you talk about is the obvious, you look stupid.
CS enabled me to write cleaner, simpler code in 5 lines instead of 30 lines in JS. While I don't care about the LOC as a metric of performance, I do have a limited short-term memory and can't remember the intricate workings of a class I wrote 2 months ago. Being able to recollect how a class functions is significantly easier if you have to read 50 LOC instead of 300.
I don't understand why people worry about being pro or against a language or a variant. Before CS, I managed to write decent JS that made me productive. With CS, I write better code and am more productive. Hence I continue to use CS. YMMV.
Also it's amusing to see this was posted to HN by jashkenas himself.
While I haven't used CS for anything professional yet, I've used it for personal projects and it's been pretty nice. Except for the lack of a great reference guide. I've spent more time Googling than I'd like to.
But compared to what I'd have had to do in Javascript for the same code... There's no way I'd have used Javascript for a lot of it.
CoffeeScript is definitely a competitive language for me.
> OK im done ranting at invisible Brendan Eich now (as if hes going to read this) :-)
Write a more cogent piece, and he will. I'm amazed at how generous Brendan is with his time. He responds to tweets, and to numerous comments on his blog. When I asked him to look over the part of my CoffeeScript book that deals with the history of JavaScript, he not only did so, he also offered technical corrections and suggestions pertaining to other parts of the book. Just today, he took to HN to participate in a vigorous discussion of Google's forthcoming Dart language: http://news.ycombinator.com/item?id=2982256
In short: Rather than using the creator of JavaScript as a strawman in a meandering diatribe (one that's 3,700 words long and yet "only 1/3 done"), you should try to organize your thoughts and engage with him.
That being said, CoffeeScript has bugs[1]. I've run into its bugs before, and there are few things more frustrating than dealing with bugs in your language.
[1]: https://github.com/jashkenas/coffee-script/issues?labels=bug...
I guess it really depends on our definition of fundamental. Certainly, it doesn't turn JS into Lisp. But it does introduce concepts that while possible in JS, are not nearly as easy and transparent to use. E.g. the 'do' keyword. When I write CS, I think using 'do' and not "let me insert a closure here to ensure variable values aren't overwritten in the loop." Same with comprehension, function binding (=>), and classes in CS.
Syntactically, I can't live without Heredocs because my project involves a lot of HTML generated dynamically through JS/CS.
Those are not here.
My problem with CS is the way it is taught and demonstrated, with every example trying to outdo the last in how much syntax they can leave out. It makes the code "pretty" but unnecessarily complicated. Otherwise I am a fan of reduced boilerplate, comprehensions and the like. Just don't expect me to remove () just because I can.
"CoffeScript make you more productive!"
Not if I'm wildly proficient in Javascript and hate Ruby.
Horses for courses, Andrew. Some mechanics prefer Mac tools, while others prefer Snap-On. The only one that is wrong is the one who claims they built a better motor because of the brand of tools they used.
I agree that it can help a bit, but I've tried it, and I didn't notice enough of a productivity increase to bother adding a compiler step.
I'm the type who would use and occasionally has used assembly (this was embedded stuff mind you), so I might not be representative.