Intro to CoffeeScript
I’m a big fan of CoffeeScript. Daniel and I built all of Thingdom in it, and we at FiftyThree are building our next product entirely in it, as well.
Other JavaScript developers aren’t in such love. CoffeeScript has become a subject of great controversy, and it’s created a sharp divide in the community and ecosystem.
There’s nothing wrong with people disliking things, of course, or different people preferring different things. Variety is indeed the spice of life.
What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies.
I say this from experience. Daniel and I didn’t happily agree on CoffeeScript at the start; he pretty much forced it down my throat. But now, I’m grateful that he did — otherwise I may truly have never tried it.
The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. And that’s precisely what languages like CoffeeScript are to programmers who aren’t used to them: new things that compete with what they know.
Paul Graham has written about a similar phenomenon in his famous essay, Beating the Averages. In it, he describes the “Blub Paradox” — when a programmer fails to recognize languages more powerful than the ones they already know:
As long as our hypothetical Blub programmer is looking down the power continuum, he knows he’s looking down. Languages less powerful than Blub are obviously less powerful, because they’re missing some feature he’s used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn’t realize he’s looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.
Indeed, I, too, dismissed CoffeeScript when I first saw it. But now that I’ve actually learned it and used it, I see how wrong I was: CoffeeScript truly is more powerful than JavaScript.
This is the context I always set to people who are uninterested in learning new languages or tools: you can only know once you’ve learned and tried. And I keep reminding myself of this, too!
With that, I had the great opportunity to give a talk on exactly this — learning CoffeeScript — at the excellent QCon NY, and I’m happy to share the slides and transcribed notes here:
Like my Neo4j talk, be warned that this viewer may not work great in all browsers. It works nicely in Chrome on a laptop or desktop.
If you’re new to CoffeeScript, or even if you aren’t, I encourage you to give this a read. It covers a lot, so set aside some time. I’m optimistic that you’ll learn something new. =)
(If you’re already proficient in CoffeeScript, skip ahead to the section on classes for some fun metaprogramming tricks!)
So check it out, and let me know if you have any feedback. Enjoy!