5 ms·
Why Do All the Great Node.js Developers Hate CoffeeScript?
- agscala 14y agoI dislike using coffeescript mainly because the language is too flexible. Being able to optionally omit a ton of syntax has led to some annoying problems that aren't obvious at first glance. This ambiguity is exacerbated by the way javascript is typically used (chained methods, nested lambdas, etc). The other gripe I have is that debugging it is a pain in the ass since errors that come back reference the javascript code, not the coffeescript. Apparently this is a problem being worked on but it's still irritating.
- roh26it 14y agoBut because nesting is a pain-in-the-ass in coffeescript, I've become used to breaking down code into chunks and invoking functions which ultimately makes code more readable solving many other problems. I do agree on the debugging aspect. I always have to go back to the compiled javascript to understand errors. Can you please point me to solutions being worked upon in this regard? Open source?
- jrajav 14y agoOne of the things provided by the CoffeeScript Redux project is source mapping, which enables line-to-line correspondences for debugging. https://github.com/michaelficarra/CoffeeScriptRedux https://github.com/michaelficarra/CoffeeScriptRedux http://ryanflorence.com/2012/coffeescript-source-maps/ http://ryanflorence.com/2012/coffeescript-source-maps/
- roh26it 14y agoCoffeeScript Redux project seems interesting. Thanks!
- svachalek 14y agoI've found the second case is actually the fix to the first; any funky compiler interpretation of my source is immediately visible in the .js code. But overall I agree; I wish they'd fixed the JS quirks that they did, allowed indentation instead of braces, added their lambda syntax, and stopped about there. It goes too far on optional syntax and functional features that are gradually being added to JS anyway.
- jrajav 14y agoTL;DR: Several high-profile Node.js developers seem not to have used CoffeeScript for any of their public projects (unless you count forks). In addition, some unspecified expert Node.js devs (perhaps the same ones, perhaps not) made an unspecified joke involving CoffeeScript on a podcast. Therefore, all the great Node.js developers hate CoffeeScript. I'm not arguing what the article seems to circle around to near the end - that CoffeeScript is worth trying - but its nominal premise seems a little shaky. Perhaps those developers simply feel as I do, that Javascript syntax is fine and there's not that great of an incentive to switch. I actually like braces and semicolons, and I definitely prefer function literal syntax to arrow syntax.
- roh26it 14y agoIn the end, its just syntax. Some like the python/ruby-esque mode and thus go for coffee.
- cnp 14y agoI used to really enjoy writing in CoffeeScript, but lately I've been finding that it's much more difficult to read after the fact. As TJ put it -- "word soup".
- jasonkostempski 14y agoIn the end it's another syntax, another compiler, several new plugins for your editor, another dependency, a bunch of new abstraction, another unproven technology, another black box, etc. It's not so simple, the choice shouldn't be made lightly.
- JimmaDaRustla 14y agoI'm learning the variable scope of javascript very thoroughly because it is powerful. I don't want to be hindered by shortcuts eliminating some of that power/understanding.
- tluyben2 14y agoWithout trying in jsfiddle, what does this alert; var i=3; function x() { alert(i); var i=5; } x(); and why is this powerful? I agree with you mostly, but I don't like this 'feature'. Edit: hoisting yes, but why, besides compiler optimization is it more powerful for the programmer than if it would not do hoisting, or, why is it in a modern language like JS? Edit1: I'm not in favor of coffeescript I used Javascript most of the time during my work day, I was just seriously wondering, if not for low level optimization why it would be a problem to have global scope until local is defined.
- deelowe 14y agoundefined, of course. What's confusing about it? The function hoisting?
- tluyben2 14y agoThe hoisting yes. I didn't say it's confusing. I said I don't like it. And more particular I don't see why it's powerful and why the logical result (being that it takes the global i until the local is defined) would be less powerful.
- grannyg00se 14y agoJavascript is great if you don't do oddball things with it. Nobody can rightly deny that there is a ton of potential to do stupid things with javascript. I'm sure someone could write out a line of [other language] code that is quite the head scratcher, and works as defined in the spec. If coffeescript works as a nice complete syntax re-do for you, that's good but you have to learn two programming languages in that case. I prefer raw js, auto-linted to help highlight any potential stupidity. In the supplied example, the var at the end of the function would be caught by the linter indicating that it leads to bugs and there is no good reason to do it - so don't.
- doomslice 14y agoI like CoffeeScript. It makes writing some things in JavaScript a little bit easier and maybe even a little bit faster. However, I don't like _using_ CoffeeScipt. It immediately shuts out the other 85%+ of JavaScript users who aren't familiar with CoffeeScript from reading and understanding my code.
- raganwald 14y agoI've been accused of writing linkbait-y titles in the past, such as "CoffeeScript isn't a language worth learning." https://github.com/raganwald/homoiconic/blob/master/2011/12/jargon.md https://github.com/raganwald/homoiconic/blob/master/2011/12/... So I suppose I'll have to just say that looking at the article itself and argue the content rather than the packaging. So here's the premise: A bunch of great JS developers aren't also CS developers. Possibility #1: Correlation == Causation. Writing CoffeeScript rots your brain and makes you unfit for writing great Node.js code. Possibility #2: Writing great Node.js warps your brain such that CoffeeScript is unpalatable. Possibility #3: Writing great Node.js code means you're very comfortable with JS itself and your tool chain, and thus you look askance at any switch. I'd say that both #2 and #3 are far more likely than #1. Neither of them imply that you shouldn't use CS today if it seems appealing.
- masklinn 14y agoI'd give 3 more possibilities: #4 pretty much the only advantage of CoffeeScript is saving a few keystrokes, not worth spending time on #5 most of your day is still spent reading javascript, the mental overhead of switching between JS and CS all the time makes it unappealing #6 using javascript makes for writing better javascript libraries than coffeescript
- olalonde 14y agoI'm not sure I qualify as a "great Node.js developer" but for me it's #5 all the way.
- raganwald 14y ago#5 is probably true for many people. #6 might be true, might not. Amplification of your ideas would be welcome. #4 needs some clarification. If you're making a global statement, then you're contradicting my experience and the statements of many CS users. Agree or disagree, clearly it's "debatable" and not axiomatic accepted fact. Or you might be saying that for some developers, including the quoted node developers (and possibly yourself), there are insignificant benefits. I listed the possibility that the node developers saw no significant return on investment, so if that's what you're saying, then we agree.
- mratzloff 14y agoI love CoffeeScript. But then, I am well-versed in JavaScript. People who don't understand scope, lambdas, prototypes, etc. should stick to JavaScript, as CoffeeScript obscures some of that. You really should understand what's going on behind the scenes. Which makes it all the stranger that experienced JavaScript developers seem to avoid it, while less experienced ones embrace it. My main gripe with CoffeeScript (there are a couple, but here's one) is code organization/readability when a method takes multiple functions as arguments. foo -> bar() baz() quux() , (error) -> throw error if error That does look a bit odd, and you run into these a lot when you're using caolan/async. You can avoid this by avoiding anonymous methods, but with so many callbacks in Node.js that is probably less readable.
- roh26it 14y agoNodejs and Coffee are surely a nightmare. I've tried using async to improve code readability but it still doesn't fit well with coffee.
- schwabacher 14y agoI agree that function calls like that can get weird in coffee - I like to write them like this, which i think turns out to be a little more readable: foo( -> bar() baz() quux() (error) -> throw error if error )
- svachalek 14y agoYou can assign the functions to variables and then make the function call in one line. Adds one line of code and a lot of readability.
- mratzloff 14y agoYes, but please see my last sentence. With so many callbacks in Node.js, it can make it just as difficult to follow.
- todd3834 14y agoI just love JavaScript
- steverb 14y agoI'm not a great node developer, but I personally don't like CoffeeScript for the same reason I don't like UI interfaces for Git. I'm never sure what it's going to do. Yes, I could go look at the output, or go really learn it, but if my goal is to produce javascript then it's just another leaky abstraction on top of something that isn't that hard to do by hand. If my choices were CoffeeScript or ASM, then I'd choose CoffeeScript in a heart beat.
- carsongross 14y agoI question the premise.
- account_taken 14y agoI don't get it. Look at Jade, Stylus ... pythonesque isn't it. The same arguments that are made against CoffeeScript certainly can be argued for those sugar syntax alternatives of HTML and CSS respectively. Some will argue ad nauseum for not using semicolons and then hate on CoffeeScript. I've had no problems debugging or understanding CoffeeScript and while I'm not at the level of a Jon Resig, I can more than hold my own with Javascript. CoffeeScript is just syntax and generally safer than plain Javascript. It will declare vars for you if your forget. It will use an optimized for loop. It will put a wrapper around code to minimize leaks ...
- tjholowaychuk 14y agoThe main difference there is with stylus / jade you basically have two states, tag and non-tag, rule and property, so it's much less ambiguous. Once you get into lots of logic in either however they similarly ambiguous, there's no doubt about that
- tmcw 14y agoGreat node.js developers are writing libraries, not application code, and they see a difference: libraries are abstractions that try to build upon as little abstraction as possible, and attempt to integrate with as many 'things' as possible. CoffeeScript's advantages - clarity and concise code - are outweighed by the feeling of building on an abstraction, and narrowing your contributor base. This feeling may be increasingly inaccurate: a lot of people write coffeescript, it's pretty well integrated nowadays.
- tjholowaychuk 14y agowe write plenty of application code actually, all of us listed there I'm sure, we just dont give a shit about the "features" coffeescript "adds"
- tmcw 14y agoand here I was trying to be an apologist and be nice :)
- davej 14y ago> 'we just dont give a shit about the "features" coffeescript "adds"' I'm not sure why you're claiming to speak for the other nine developers listed in the post. It's a good point that tmcw makes. Plenty of developers, including Jeremy Ashkenas (creator of CS), write their open-source library stuff in vanilla javascript while hacking away with CoffeeScript for other things which don't rely on community contributions.
- dmethvin 14y agoThere are "systems developers" and there are "applications developers". The two groups often use different tools, so JavaScript vs CoffeeScript isn't much more surprising than C vs C++ or Win32/COM vs .NET for that matter. Systems developers provide services for other developers; generally they want to minimize dependencies. It doesn't make sense to write foundational tools in CoffeeScript unless all the clients of those tools will be written in CoffeeScript as well. Otherwise you're just adding complexity to their projects and making them harder to debug.
- dschiptsov 14y agosystems developers? You mean those guys who wrote V8 in C++?)
- geoka9 14y agoYou mean those guys who wrote C++ in C?
- addlepate 14y agoJeez, there's the word "hate" again, second time this morning. What a bunch of drama queens we all are. Not particularly caring for a language or disagreeing with the premise for its creation is "hating". OK. And here it's even worse, because the author elevates these developers to the status of "great" and then paints the fact that they do not care for CoffeeScript as "haughty".
- pjmlp 14y agoI don't care about any language that isn't natively supported in the browsers. Not all browsers have support for source maps, and sometimes you really need to debug browser specific behaviours without having to debug generated code along the way. Additionally in most teams I work on, it is often the case that besides myself no one even knows what CoffeScript is. CoffeScript just adds more code to debug without any real benefit.
- dschiptsov 14y agoBecause CoffeeScript causes a cognitive dissonance by a) Attempting to address Javascript's shortcomings. b) Shows how much more comprehensible a well-designed language could be. c) Shows what one smart guy with a deeper CS knowledge and good taste could do.)
- jtchang 14y agoThe reason I have not learned coffeescript yet is because I want to truly understand javascript. I feel that learning something more portable is the way to go. As I understand more javascript I think about what problems CoffeeScript is trying to solve.
- gavinflud 14y agoI'm not a very experienced Node.js developer, but I have taken the time over the last couple of months to learn how to use it. I find working without CoffeeScript to be much more productive. Then again, that may change when I get a lot more comfortable using Node. At the moment I just prefer to know exactly what's going on under the hood.
- Weltschmerz 14y agoPersonally, I would want to understand JavaScript before moving on to some abstraction. The official Node.js documentation is written in JS, etc.. Then, once I am totally capable with JavaScript, there just isn’t a great incentive for me to learn another language to code on top of the same environment. I’m very happy with JavaScript. CoffeeScript has become an instant turn-off to me, and I think this sentiment is common in the community. If someone asks for help in the IRC channel, I just can’t offer a thing. And usually no one can. I’ve seen many calls-for-help that fell on deaf ears because few people are willing to learn CoffeeScript for assisting a fraction of the community. Why do I hate CoffeeScript? Because I like helping people. :( This is my personal history, and you may notice that I am totally ignorant of any benefits that CS may provide by way of being more concise, or linguistically harmonious.
- geuis 14y agoQuote: "Having defected from Rails, I love CoffeeScript." This is a common reason I've heard. Here's the bottom line, CoffeeScript is not javascript. Suppose you want to speak Japanese but only know English. Google comes out with Translate 4.0 that does realtime translation on the fly. Great! Now you can speak Japanese, right? No. Most of the devs I've personally interacted with that like Coffeescript are conversely bad at javascript. Admittedly this is anecdotal and only based on my personal experiences. Learn javascript. Get a book, read some tutorials. Quit trying to squirm around just because closures make you nervous.
- lnanek2 14y agoThis is like analyzing some of the huge Java projects out there, noticing they don't use Scala, and deciding everyone hates Scala. Particularly with public projects, you want them as easy to use and simple and require as little as possible to get into them. Adding an extra language translation will not help with those things, especially if the language is not as common as the one it translates into. I don't particularly like Java compared to some other options, but I still code in it most, simply because of the huge number of libraries and developers who use it. It's very difficult to write any big project by yourself, which means you need others, which means you need to not use obscure languages and other technologies that prevent working together. I much preferred writing for Linux PDAs than I do writing for Android smart phones, but if I did that, no one would use my stuff. :)
- buster 14y agoI don't truely see enough benefits for coffeescript. 99% of the eco-system uses vanilla JS and i would like to stay in one "language" as much as possible. In general i don't really feel comfortable with code-generating layers that abstract away what i want (and need) to know. I want to look into the Chrome Devtools, see "line 23 in bla.js" and correlate that to the source in my editor. Same reason i don't use all that less/sass/haml etc. etc.
- Xcelerate 14y agoI really love CoffeeScript. Javascript has some great programming concepts within it and CoffeeScript makes these more elegant and easy to use. The reduction of needless syntax is also a boon to me. In fact, I've been using CoffeeScript to postprocess data from molecular simulations (supercomputer output). It's about 3x less code than an equivalent C program and requires a lot less thinking so I can get things done quicker. But I tend to use CoffeeScript in a functional style (which in my opinion is the best language paradigm for handling a lot of data).
- grabastic 14y agoI doubt that the CoffeeScript-haters would accept any compile-to-js language. Maybe it's language stockholm syndrome. ;) But for me, JavaScript's shortcomings are far worse than CoffeeScript's.