Skip to main content

All I Want for Christmas: If Hemingway Wrote JavaScript

By Adam Roberts

JavaScript

Share:

😳 Ever felt a little embarassed sharing your JavaScript? Let's fix it.

We asked SitePoint authors what developer toys they would want for Christmas, then managed to source them — without relying on Santa.

If Hemingway Wrote JavaScript is exactly what it sounds like: A thought experiment as to how 25 well-known literary figures would tackle various JavaScript problems.

From the titular Ernest Hemingway (whose solution is terse and effective, as you’d expect), to post-postmodern darling David Foster Wallace (whose solution is long, discursive, and references his background in mathematics), pretty much everyone famous for writing in the last few centuries takes a stab at coding their way to a solution for a given problem.

The book is written by Angus Croll, on Twitter’s UI team, who knows a bit about JavaScript.

If Hemingway Wrote JavaScript

Angus Croll / No Starch Press

Why I Wanted This Book

Given I work on the content side of a technical publication like SitePoint, something that fell in the middle of those two worlds had an instant appeal. I know a bit about literature, and I like the idea of knowing a bit about JavaScript, although I haven’t quite gotten there yet. This seemed like a way to indirectly learn a bit more about the language while indulging my literary side.

The Experience So Far

I hadn’t expected to laugh so much at a bunch of code. This is a very clever, impressive book, full of amusing examples that show the versatile (or is it chaotic?) nature of both JavaScript and the English language. I haven’t covered every author yet, but some unexpected delights came from Tupac’s solution, incorporating rhyme and flow, and J.K. Rowling’s magical code.

Unsurprisingly, Kafka’s solution leads (Metamorphizes?) to a crushing bug, leading his code to recur endlessly. As Croll says, “very Kafkaesque”. A fitting end to a worthwhile read.

Which author, lyricist, stand-up comedian or orator would you want to see code? Answer in the comments, we’ll pick the best answer and send you a copy of the book!

Adam is SitePoint's head of newsletters, who mainly writes Versioning, a daily newsletter covering everything new and interesting in the world of web development. He has a beard and will talk to you about beer and Star Wars, if you let him.

New books out now!

💁‍♀️ Fun Fact: Python was ranked #2 on a recent highest paid coders list. *


🤓 Ok. When did a code editor from Microsoft become kinda cool!?