Agreed. It really sounds like the author doesn't want to like CoffeScript for reasons along the lines of "CoffeeScript is just some hipster code for people that like the idea of being great programmers"
TLDR: "All these hippies are doing things that don't benefit me! I don't want a new programming language! Whine!"
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.
If you read the whole article the author is actually not saying that he agrees with those complaints. And yes as an Electrical Engineer I can write assembly code.
I love and use CoffeeScript because it removes almost all of JavaScript's cruft, making the true purpose of the code much clearer. Ultimately, removing cruft is all CoffeeScript does—it doesn't fundamentally change JavaScript—but man does it do it well.
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.
> it doesn't fundamentally change JavaScript—but man does it do it well.
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.
I like the idea of CoffeeScript. But so far, for me, it's just not better enough for me to use it over plain JavaScript. The reason I use C over assembly is b/c there is such a HUGE difference. If C were only marginally better I wouldn't bother with it either.
What kind of JS projects do you have? CS is certainly overkill for form validation but if you have 50+ JS files that all need to talk to each other, CS can help make things cleaner and succinct.
Don't think I've got anything quite to the level of 50+ files, but I've done some smaller scale javascript only applications where the only thing done backend was a restful database wrapper.
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.
I wrote the user-interface for my iPad app in JS (using PhoneGap) initially. Working on a large pure JS UI project sure makes you realize the shortcomings of JS, both fundamental and syntactic. It took a week to convert the JS to CS by hand and I did it hoping that the one-time effort would pay itself off over the next few months of development. Within just 2 weeks after the conversion, I started cranking out more features than I had in months before, and surprisingly with very little new code being written.
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.
Nit-pick: 2 months is not 'short term memory'. Short term memory is limited to the now. It's limited to things you are actively thinking about.
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.
Well written, though a tad [ok, way too] long. Having had TJ reject a Coffeescript related pull request of mine on a project of his I have experienced his and the Learnboost teams distaste for Coffeescript.
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.
Ha, your comment made me wonder momentarily if the essay was a work of post-modern art, subversively advertising the benefits of CoffeeScript through an implausible flourish of logorrhoea. If so: Well done, sir.
> 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.
Maybe the author should just, you know, not use CoffeeScript. I have a problem with preferential statements framed as empirical statements as well.
"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.
Hey im the author. Its pretty clear im getting murdered here on how long winded yet incomplete my post is. Next time I'll wait till its done to post :-) and edit a lot more. I lol'd at some of these comments. I certainly don't take myself too seriously but obviously have strong opinions about JS and the direction of harmony. I have used the very hot topic of CS as a hook to talk about something a bit more boring, the standards process and where its taking JS. Thanks so much to those that read the whole thing, I'm sorry it made it to HN before I finished it. Seeing as how I've had all of 5 visitors to my blog I wasn't expecting to get too much visibility to it. It was more a way to organize my thoughts and stop accosting my co-workers at lunch time with my long winded rants. But I am still working on it and will post the other parts and a much shorter min version once its done.
22 comments
[ 4.6 ms ] story [ 55.8 ms ] threadThose are not here.
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.
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.
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.
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.
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.
> 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.
"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.