Should I learn CoffeeScript?

I’m looking into learning CoffeeScript. I’ve heard it’s way faster then regular JavaScript and is becoming the norm for developers. Any experience with this? Also do you have a preferred method of learning it? I.e. favorite book or website?

1 Like

No one is going to tell you not to learn new things. I mean why not learn it and add something new to your skill set.

1 Like

thanks for reading the first half of the post, but are you able to tell me about your experience with Coffeescript?

SitePoint have a book you might find interesting: https://www.sitepoint.com/premium/books/jump-start-coffeescript

4 Likes

Since the code gets converted to JavaScript before it is run it will be slower than JavaScript - not faster.

Also many of the shorter commands that coffeeScript has that used to be converted into multiple JavaScript statements can now be converted into one JavaScript statement.

1 Like

No, cause I could care less about coffee script. If I need to use it one day I’ll learn it. Until then I have no interest.

That’s unlikely to occur. All the useful parts of CoffeeScript have been copied into JavaScript. By the time browsers support ECMAscript 2016 there shouldn’t be any need for CoffeeScript to continue to exist - all the commands will have a one to one JavaScript equivalent to be converted to in order to run.

Thanks…I’ll check it out!

@felgall I mean faster to write and dev with, not execute. As this is all people who are focused on the bottom line care about.

Since JavaScript and CoffeeScript take the same amount of time to write each line of code and there is now a one to one correspondence of commands between CoffeeScript and the latest version of JavaScript, any script should take exactly the same time to write in both languages assuming that you actually know both languages equally well.

Running the step to convert the CoffeScript to JavaScript or the transpiler to convert the ES2016 JavaScript to ES5 JavaScript that browsers can actually run should also take the same amount of time.

Any advantage in development time that CoffeeScript used to have is now gone and once browsers support the latest JavaScript without needing the code to be transpiled then JavaScript will gain a development speed advantage over CoffeeScript. CoffeeScript is a dying language - the advantages it originally provided have all been incorporated directly into JavaScript.

1 Like

I’ve been actively using CoffeeScript almost exclusively for the past 4 years and it’s been great.

This video was the reason I first picked it up and the benefits are still valid.

All the useful parts of CoffeeScript have been copied into JavaScript

I disagree with that statement.

Yes, a lot of it’s features are in es6

  • arrow functions
  • default params
  • destructuring
  • classes
  • rest params
  • string interpolation
  • better looping mechanisms
  • generators

Things that aren’t that I have found very helpful are:

  • No var declarations
  • significant whitespace
  • automatic returns
  • everything as an expression
  • A bunch of more readable aliases and operators

Significant white space(using indentation rather than curlies to represent blocks) and everything as an expression are now the biggest differences between coffeescript and JavaScript.

It’s not so much the features of CoffeeScript that I love, it’s the syntax, I find the code more readable and the language simpler than JavaScript. It’s all the same stuff, just spoken with a thick accent.

I’ve heard it’s way faster then regular JavaScript and is becoming the norm for developers.

No, it’s definitely not the norm.

The momentum has definitely gathered around ES6 now and the tooling and resources are maturing a lot, if you join a team of developers the chances are they’ll want to use es6 and not CoffeeScript so you may not be able to use it in a team setting. There are certainly many useful large projects that have been written in CoffeeScript, for a “new” language it’s always ranked very highly in the list of languages by popularity on Github but I suspect it may become niche(if not already) as all of the new developers these days will be introduced to jsnext.

2 Likes

This argument never held any water with me, this day will never arrive. We will be compiling JavaScript forever.

1 Like

You’re arguing these things never having written CoffeeScript seriously. You’re right that most features are the same now(arrow functions, destructuring, default params, for of loops). But it’s not the features of the language that are important, it’s what they took away.

It seems to me that JavaScript brought everything they could from coffeescript without breaking backwards compatibility - in essence, they could not take anything away they can only add new things in making a more convoluted and burdened language.

For example, the js folks were not able to fix the problems with var, instead we got two new ways to declare variables. Couldn’t improve loops like for or for in we got for of. In many ways JavaScript’s hands are tied.

1 Like

So, if I’m getting this, CoffeeScript (like jQuery) for the most part is a “wrapper” that allows devs to use a different syntax that they prefer over “plain” JavaScript syntax?
i.e. writing less and / or cleaner code

I guess it’s a trade off. The benefits of being able to write in a preferred syntax vs. any problems incurred from being dependent on intermediate code.

It’s a transpiler, in the same way that Babel compiles es6 to es5, the CoffeeScript compiler compiles another version of javascript with very different syntax rules and keywords down to es3.

The trade-off is that different camps are starting to speak slightly different languages, they used to be very different but there’s now quite close. It becomes hard to work in teams where people are speaking different languages.

But yes, writing less and / or cleaner code is really the only benefit of these compile to js languages.

2 Likes

I’m going to go a bit off topic, but it amazes me how quickly the community has flipped to embrace transpilers. Most or all of the features of ES6 have been available for years through things like CoffeeScript or TypeScript, and all it took was a transpiling step, yet the community largely passed them by. But now the community has flocked to ES6 and transpiling through Babel, and suggesting that they’ll be transpiling forever, even though they could have been transpiling all along but didn’t.

2 Likes

Yes, many of the early criticism’s of coffeescript related to the need to transpile and that debugging was theoretically more difficult because the compiled code was different to the source. They ignored the fact that it was already the norm to compile(minify and concatenate js) and when sourcemaps came out this argument fell through.

I think people simply got used to the idea after doing more with grunt / gulp.

We’ll be compiling forever because software can move faster than the standards can be implemented. It also means that the things introduced back into standards are tried and tested and the good ideas will win out. In hindsight of what jQuery did really well, a lot of it’s ideas are now in js. The same is true of CoffeeScript. Standards now follow rather than lead the way.

Most or all of the features of ES6 have been available for years through things like CoffeeScript or TypeScript, and all it took was a transpiling step, yet the community largely passed them by

CoffeeScript has had far more use than most people are aware of, the numbers on Github over the years is evidence. But yes, the buzz pales in comparison to es6. I think a lot of people used it and loved it, there just wasn’t as many people writing about it and marketing it. It also had it’s fair share of opponents who disliked the syntax.

Thanks for the reply, that’s what I was wondering.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.