6 ms·
What is it about CoffeeScript that people don't like?
by joeblau 13y ago
What is it about CoffeeScript that people don't like?
- tmikaeld 13y agoI think some people still like wasting their time by writing "real" code from the start.
- rikkus 13y agoDebug story perhaps? I haven't tried it but that's what puts me off.
- rimantas 13y agoI guess some just dislike the idea of sugaring Javascript. Others my think that it hides something that can bite your ass, though imho the oppossite is the case. For me personaly after spending some time with CoffeeScript writing plain JS was a displeasure for sure.
- exDM69 13y agoCoffeeScript is only syntactic sugar. It brings very little new to the table, but perhaps worse of all, it doesn't really fix all of JavaScript's WTF-issues while adding a few of its own. While it's an improvement over JavaScript, its advantages are sometimes outweighed by the extra hassle to compile and deploy it. I don't really dislike it but I really do not see myself using it if I had a task where I needed JavaScript.
- slaxman 13y agoSuprisingly, I have never even thought about compiling on Coffeescript since my rails app does that for me. Personally, I love using Coffeescript because it's just so much easier to write compared to javascript without thinking about braces and semi-colons. On the whole, I guess what framework you use affects how you use a language. In rails projects, it's very efficient to use coffeescript over javascript.
- virtualwhys 13y agoThe problem is that sometimes what you write in CS results in surprising and/or incorrect JS. This can be caused by an unnoticed block of whitespace, corner case of CS language itself, or me simply screwing something up. About 5-10% of the time I hit a WTF in CS, which is, for now, an acceptable trade off vs. using pure boilerplate ridden JS. If there was a concise TypeScript a la Scala for Java, I'd be all over it.
- throwaway_yy2Di 13y agoThe syntax is broken. Things like operator precedence and associativity are the exact opposite of math conventions: f x + f y // is f(x + f(y)) f g x // is f(g(x))
- omni 13y agoI don't understand what's wrong with the second example. What do you think it should do?
- throwaway_yy2Di 13y agoIn ML-family languages like OCaml and Haskell, function application is left-associative: f g x = (f g)(x).
- jashkenas 13y agoNot quite -- the rule is pretty simple: Implicit function calls associate to the right, to the end of the line (or the end of the trailing block). This allows you to write code like this: console.log inspect value model.save(attrs).then -> ui.update attrs rect.scale height * factor ... and have all of the results come out correctly, while leaving the code readable. If the rules were "more math-like" as you say, then none of that would work. Perhaps it would harmonize with special libraries that used functions (automatic-partial-application a-la Haskell) in a different way than JavaScript does ... but that's not the world we live in. It's gotta harmonize with JS functions as they exist.
- throwaway_yy2Di 13y agoMy brain isn't plastic enough to make this switch. :( For me, those code examples are uncomfortable to look at. backwards read to trying like It's
- jashkenas 13y agoRight-o. The trick is to "read" it like pseudocode, or like English-ish. Log the inspected value. Save the model, then Update the UI with the attributes. Scale the rectangle by (the height times the factor). The big syntactic difference still being the "model.save" vs "save the model" ordering of dot-notation. But them's the breaks.
- semjada 13y agotoo similar to python
- leokun 13y agoIt's near unreadable. It's optimizing the wrong things, prettiness (I don't think it's very pretty at all) and keystroke counts, vs readability, fewer errors and maintainability. It also bugs the fuck out of me that CoffeeScript projects frequently end up being given a *.js extension in the name and how often people who want nothing in the world to do with CoffeeScript, people like me, end up having to deal with it for some reason. Like I don't like ada, and I never have to look at it. ada never ends up in my editor or on a github page I'm looking at, but frequently someone puts CoffeeScript somewhere where someone was expecting JavaScript, like a StackOverflow answer, or a package for Meteor, or something. If CoffeeScript stayed out of my life, and I out of it, I would probably hate it a lot less. It's not that it's transpiled. I mean that isn't a great thing, but for example I like the idea of Dart and even TypeScript. But CoffeeScript? No thanks.
- deleted 13y ago[deleted]
- jashkenas 13y ago> [...] how often people who want nothing in the world to do with CoffeeScript, > people like me, end up having to deal with it for some reason. Like I > don't like ada, and I never have to look at it. ada never ends up in > my editor or on a github page I'm looking at, but frequently someone > puts CoffeeScript somewhere where someone was expecting JavaScript, > like a StackOverflow answer, or a package for Meteor, or something. > If CoffeeScript stayed out of my life, and I out of it, I would probably > hate it a lot less. As the creator of CoffeeScript — I think your answer here is right on the money. It's a pretty perfect answer to joeblau's question.
- camus 13y agoFirst thanks, Coffeescript saved me days of work. But I can understand , because it's popular , some people feel like they are forced to understand or learn it. Yet you can be proud that Coffeescript influenced the latest ES spec, that's all that matters , you pushed Javascript forward, by saying "Dont wait for other to make the stuff you need, do your own stuff and eventually people will wake up and adress your intial issue".
- city41 13y agoSignificant whitespace
- iliiilliilil 13y agoIt was a good idea but failed in execution. It might take fewer characters to type an instruction but at the cost of what? Being difficult to read? Ambiguity? Not really worth the time.
- lowboy 13y agoAny unfamiliar language is hard to read and will have seeming ambiguities. In my experience working with CoffeeScript, I've always found well-written code easy to read with no ambiguities.
- ahoge 13y agoIt's a quirky dialect of JavaScript, which has very little to offer. There is less typing, but that certainly wasn't JavaScript's biggest issue. With languages like TypeScript, or Dart, you also reduce the amount of typing work, but that's just a side-effect of the good tooling these languages have to offer. You can auto-complete everything. It makes a lot more sense to boost productivity via structure and tooling, because that's what really helps with scaling.
- jashkenas 13y agoMost of the time, it's easy to ignore programming languages that you aren't familiar with. In day to day programming life, you're not going to be running into many examples of Eiffel, or Dylan, or D or E, in the wild. So you're not going to feel very strongly about them, either pro or con. For better or for worse (I think for the better), CoffeeScript is fully interoperable with JavaScript. The runtime characteristics and the lowest-common-denominator ES3 support are such that you can use it just about anywhere you might want to use JS. That, and a modicum of success, means that JS programmers sometimes stumble across it in unexpected places, only after popping the hood. e.g. "I thought I was just using a simple library -- Eauggh! What is that stuff down there!" This makes it very hard to ignore... As a JavaScript programmer, you're forced to ask yourself the question, "Why haven't I given CoffeeScript a real try yet?" Not all, but a large part of the dislike comes from folks rationalizing their response to that question to themselves. tl;dr, CoffeeScript is almost perfectly situated to inspire fear and loathing in JavaScript programmers with closed minds.
- leokun 13y agoI frequently experiment with new programming languages (go, Rust, others) and I like Dart and have tried it. That's significant evidence that I'm not close minded. However CoffeeScript was at least for me the first of its kind, so maybe my negative perception has stuck with it unfairly. I do find it hard to read, but I'll tell you what I'll give it a try. :P
- lowboy 13y agoI found it a little awkward to read at first, but that went away in a short time. I suggest giving it a proper whirl. Most people who I've introduced to CS seem to really like it.
- joeblau 13y agoAh okay, that's a pretty interesting review. I was at an AirBnB Tech Talk and Isaac Schluetter (Head maintainer of Node.js) and he discussed his feelings on it. I've used it a few times and it's been fine, but I never felt compelled to learn it. [1] - http://www.youtube.com/watch?v=zM-gUM9C5SA&feature=player_detailpage&list=PLECD54527EBCE4021#t=2775 http://www.youtube.com/watch?v=zM-gUM9C5SA&feature=player_de...
- nikoftime 13y agoVery interesting that people are saying things like "significant whitespace" and "too similar to python" - I personally love Python and I like that coffeescript bears some resemblance to it. I voted "Coffeescript - Like" because it removes many of the mundane aspects of JS programming. Definitely doesn't solve many of JS's problems, but it certainly makes things easier when writing client side apps. We use it a lot for Backbone development.
- ceronman 13y agoMy opinion is that it ended up causing more problems than it fixed. In theory is nice and beautiful, but once you start using for large projects you notice that it kills readability and introduces some other small problems.
- igravious 13y agoFixes a non-problem. Ok, so Javascript has a bunch of gotchas but it's an interesting language which I both like and dislike but I don't dislike it enough to add yet another layer to my dev platform. Also, as someone stated elsewhere on this page the true solution is to make a browser virtual machine and use any high level interpreted language you want.
- smrtinsert 13y agoPersonally I'm ready to start filtering anyone that prefers JS over CoffeeScript. Its just about superior in every way. Maintainability goes up as the lines of code drop precipitously and significant whitespace, come on guys. I use bracey languages all the time, and moving to one that doesn't isn't that big a deal. The real problem is there are a lot of "developers" that came up just doing simple Javascript functions. They know their functions, and they dont want their world to change. They would rather accidently reference closure or global and type significantly more code than learn a slightly different way to code Javascript. Complaints such as "extra hassle due to compilation" are laughable honestly. If adding a build step is an extra hassle, this might be the wrong profession. Tinkering should be in your nature! CoffeeScript super charges Javascript. Any truly competent JS programmer that gives it a try for a few days would realize it.
- seanalltogether 13y ago"If adding a build step is an extra hassle, this might be the wrong profession." That's a very railsy answer. The strength of the web is that you don't need to run a build at all. I think that's the fundamental dislike of Coffeescript. I've worked on so many html frontends where a build process wasn't necessary to accomplish our job, and if someone tried to introduce one for the sake of coffescript it would simply be an annoyance.
- XorNot 13y agoIt's also that you lose any ability to step-debug at the moment. You still need to know Javascript to debug Coffeescript by and large. That mental context-switch overhead is the whole driving philosophy behind NodeJS in the first place - don't switch languages so often. CS/JS is enough of a change that the overhead is not insignificant.
- winslow 13y agoThis is no longer true. You can debug CoffeeScript in web browsers now with source maps. Yes you may need to dig into JS for a more severe bug but most of the stuff is debug-able in source maps.
- mcgwiz 13y agoThe problem for me is not technical per se, but that it adds another element of complexity to an already complex programming environment and has implications for human resourcing. Becoming expert in a new language goes beyond learning syntax; one must also learn code conventions/style, compiler/transpiler quirks, runtime quirks, and library/framework ecosystem. In CoffeeScript the last two may be moot, but the first two remain. Additionally, to be an expert in a transpiled language, one must be an expert in the target language. It is much harder to find someone that has this knowledge and experience in both CoffeeScript and JavaScript. This begs the question of each web dev team: if you are already experts in JavaScript, is the value-add from the transpiled language worth the cost of increased solution complexity/cognitive load, and smaller talent pool? My take is that CoffeeScript doesn't meet that bar for most teams. For individual projects, or isolated one-off tools, these non-technical issues are moot. Also, server-side may be less of an issue since complexity is reduced by not having to write for multiple runtimes (only Node.js and usually without DOM).