found drama

get oblique

review: Functional JavaScript

by Rob Friesel

Functional JavaScriptJust like it says on the tin, Functional JavaScript (Michael Fogus 1; O’Reilly, 2013) is just that: a book about writing JavaScript in a functional style with Underscore.js as the foundational library to give you some of the higher-order functions you need to get started. 2

First, a disclosure: I have a very personal relationship with this book. Fogus is an old friend, and when he asked if I would help review it, I jumped at the chance. “JavaScript? Functional programming?” If the book was dipped in chocolate and came with a snifter of rye, it couldn’t be any more of my favorite things. And in this way, I had the privilege of reading some early drafts and watching it take shape.

What Fogus has written here is an outstanding introduction to functional programming as a style/paradigm, but he has also written what I consider to be the authoritative text on applying that style to JavaScript. He takes many of the sophisticated 3 functional concepts (e.g., pipelines, currying and partial application, protocols/mixins, immutability) and demonstrates how to set them up using nothing more than a little Underscore and JavaScript’s basic building blocks. It’s a real treat to watch him take these concepts which may seem academic or obtuse at times, and apply them with great effect in JavaScript. And it’s particularly amazing to see him take something that might otherwise seem impossible (I’m looking at you, trampolines) and then make it look almost trivial to implement.

Just like Underscore, Fogus’ book is surprisingly-small-yet-surprisingly-powerful. It shouldn’t be your first book on JavaScript, 4 but if you’re already comfortable (or at least “serviceable”) with the language, then this is the best route into programming JavaScript in a functional way. And why not put this all together? Seriously: JavaScript is the lingua franca of the web — it’s everywhere! — and as we do more powerful things in the browser, we’re going to need more powerful programming paradigms. Functional JavaScript lights the way.

And as an added bonus: you get Fogus’ awesome sense of humor sprinkled in there, making it a very fun book as well as very informative.

I am parking this one in my library right next to the other canonical texts: JavaScript: The Good Parts, 5 Professional JavaScript for Web Developers, and JavaScript: The Definitive Guide. 6 It has earned its place there.

Disclosure: I received an electronic copy of this book from the publisher in exchange for writing this review. I was also involved in the reviewing/editing process. I’m also old friends with the author.

See Also

  1. Links: blog and @fogus.[]
  2. In that way: Underscore : collection-centric JS :: jQuery : DOM-centric JS ?[]
  3. Sophisticated to the uninitiated; properly applied, these patterns lead to delightfully simple code. After you’re done with this book, I doubt you’ll think of them as “complicated”. (Though you’ll still relish in calling them “sophisticated”.)[]
  4. Maybe your second?[]
  5. Making Fun JS more like JavaScript: The Best Parts?[]
  6. ¡El Rhino Diablo![]

About Rob Friesel

Software engineer by day. Science fiction writer by night. Weekend homebrewer, beer educator at Black Flannel, and Certified Cicerone. Author of The PhantomJS Cookbook and a short story in Please Do Not Remove. View all posts by Rob Friesel →

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*