Why Coffeescript


by Ry Walker

tl;dr people are dismissing it before they really learn it.

Some Coffeescript facts

  • It covers up javascript's warts
  • It reduces "empty" lines of code
  • You type less code
  • Javascript is way more popular than Coffeescript, at least a 6-to-1 ratio
  • Coffeescript isn't alone  — there are lots of languages that compile to Javascript
  • I use Coffeescript every day while building our Meteor apps and packages

My Coffeescript opinions

  • Code is more readable
  • It'll require extra effort to learn
  • It has BETTER syntax than plain Javascript
  • For the same reason I use Underscore, I use Coffeescript. My code is more readable.
  • The only people who go from Coffeescript back to Javascript are people who were forced into Coffeescript, or are now being forced to use plain Javascript
  • If both JS and Coffeescript were invented right now, and were competing for marketshare, Coffeescript would win. You like JS only because it's the status quo, and you're familiar with it.
  • I've tried to talk myself into doing JS for open source, and use CS only in private app code. But I just can't do it. Every }; I type is a useless LOC. And don't even get me started about those { and } and }); LOCs. They add nothing.
  • Usually boils down to this - if you have a problem with all languages that are indentation dependent (Python, HAML, SCSS, YAML) then of course you're going to be against CoffeeScript. If you've gotten to a high-level of proficiency with JS already, you likely won't want to switch. If you're coming from Ruby or Python, you'll definitely like CoffeeScript.

I see the point of view of the Javascript purists. It does suck to have a "house divided".

There is a long history of people dismissing it without learning it. 

Paraphrased: "I don't want to learn CoffeeScript. Don't use it!"

A gift that keeps on giving

When you're learning coffeescript, you'll go back to the docs and discover gems like isnt, ? string interpolation - each visit to the docs gives you new nuggets as you level up. (one more to check out: the accessor variant of the existential operator).

Readability and comprehensibility is the goal

Never write cute code. Yes you can write some crazy terse code in CS, just as you can in Ruby, Python, and even JS. Don't do that. That's not the point.

"Bad CoffeeScript is worse than bad JavaScript.
Good CoffeeScript is better than good JavaScript." - Ryan Florence 

This debate has no end

JS is and will likely remain dominant. There are enough people in each camp that you can find people in your tribe to collaborate with.

If you choose Coffeescript, you'll be in the minority. Be prepared to defend yourself. People won't want to contribute to your project because CS infuriates them. C'est la vie.

Share Share on Twitter Share on Facebook Share on LinkedIn

How Can We Help?

Reaching out doesn’t mean you’re ready to start a project, but we’d love to learn more about the challenge you’re facing, answer any questions, and see if we might be a good fit for working together.

Contact Us