Number Thirty-Nine. This is Responsible JavaScript’s book number.

Responsible JavaScript

A book about JavaScript (and sometimes wasps) by Jeremy Wagner, available soon from A Book Apart.

There’s a genus of solitary wasps named Sphex — and if you’re wondering what wasps of all things have to do with a book about JavaScript, I’ll explain.

A decorative horizontal dividing rule with a silhouette of a wasp in the center, all set in pink.

Wasps of the genus Sphex nest underground and prey on crickets. When one of these wasps brings a cricket back to its nest, it does something uncharacteristically thoughtful: the wasp conducts a nest inspection, leaving the cricket outside. Once the wasp finishes, it reemerges to retrieve the cricket.

Now for the kicker: if you — a prankster god of insectkind — move the cricket during the nest inspection, the wasp’s behavioral program reboots. The wasp knows only that the cricket wasn’t where it once was, so the wasp relocates it, drags it back to the nest entrance, and inspects the nest again.

Scholar Douglas Hofstadter coined a word from this behavior: sphexishness. When we say something is sphexish, we’re describing highly deterministic, preprogrammed behavior with the appearance of thoughtfulness. I often grumble to myself about our industry’s sphexishness and the effect it has had on the collective usability of the web.

I’m not implying that most web developers are drones incapable of critical thought — and that’s certainly not the case. We all strive to do our work the best way we know how. Yet we do many small, almost ceremoniously repetitive things as web developers that are definitely sphexish.

Consider our relentless adherence to best practices, even when they result in poor user experiences. We npm install packages without considering potential downsides or alternative methods. We chase new tools in the hope that they’ll increase our productivity — even though that constant churn invites its own insidious productivity cost.

We just do a lot of stuff that results in bad outcomes for the people who use what we make. It’s a bold assertion, yes, but one that’s well supported by data: there’s been a five-fold increase in the amount of JavaScript that websites have sent from 2012 to 2020.

Increasing the amount of JavaScript we ship results in poor user experiences, and the iron law of our work is that users must come first. Our preferences and comfort as developers are secondary.

That’s a mission to take to heart while we figure out how we can use JavaScript more responsibly in an industry that relies on it more than ever and I think that Responsible JavaScript — a carefully written book that the talented people at A Book Apart have worked with me to publish — can help you along the way.

Testimonials

If we truly want to deliver a great experience to our users, we must be better stewards of usability and performance — which is exactly what Jeremy can teach us. With over fifteen years of experience developing websites and applications for projects large and small, Jeremy has a sharp understanding of how to strike a balance between business requirements, user needs, and developer interests. An avatar of Estelle Weyl Estelle Weyl
Frontend architect and organizer of #PerfMatters Conference
A decorative horizontal dividing rule with a silhouette of a wasp in the center, all set in white.
Jeremy’s clear and straight-to-the-point style shines throughout this book, explaining dense subjects approachably. Anyone wanting to write JavaScript well should read this book. An avatar of Olu Niyi-Awosusi Olu Niyi-Awosusi
JavaScript Developer at Oddbird
A decorative horizontal dividing rule with a silhouette of a wasp in the center, all set in white.
Responsible JavaScript is a refreshingly pragmatic and motivational read, offering a blunt but deft reminder that our work comes with heavy responsibility. Do yourself — and, more importantly, your users — a favor: read this book and help us all start building better software today. An avatar of Suz Hinton Suz Hinton
Senior Software Engineer for Developer Tools at Stripe
A decorative horizontal dividing rule with a silhouette of a wasp in the center, all set in white.
Jeremy breaks down the technology that powers the modern web, and offers reliable techniques for creating robust, resilient user-facing experiences — experience that could be the difference between someone getting what they need, or being left out in the cold. An avatar of Eric W. Bailey Eric Bailey
Designer and The A11Y Project maintainer

About the author

An avatar of Jeremy Wagner

Jeremy Wagner is more of a writer than a web developer, but he does both anyway. On top of making websites for longer than he thought probable, he has written for A List Apart, CSS-Tricks, and Smashing Magazine. Jeremy will someday relocate to the remote wilderness where sand has not yet been taught to think. Until then, he continues to reside in Minnesota’s Twin Cities with his wife and stepdaughters, bemoaning the existence of strip malls.

A decorative horizontal dividing rule with a silhouette of a wasp in the center, all set in white.