'Once Upon an Algorithm' Is at Points an Enjoyable, Engaging Read

Martin Erwig's inventive analogies can't quite overcome the dry language he uses to convey them.

Once Upon an Algorithm: How Stories Explain Computing

Publisher: The MIT Press
ISBN: 0262036630
Author: Martin Erwig
Price: $27.95
Format: Hardcover
Length: 336 Pages
Publication date: 2017-08
"The idea for Once Upon an Algorithm arose from many conversations with friends, students, colleagues, and people I talk to on the bus on my way to work. I thank all of them for their patience in listening to my explanations about computer science and for their friendly impatience when the explanations became too long and complicated."

-- Martin Erwig, Once Upon an Algorithm, Acknowledgements

Once Upon an Algorithm is at points an enjoyable, engaging read, but despite Erwig's apparent assertion that this book is for anyone wanting to learn about what "computer science" actually means, it's hard to figure out who the audience for this book is.

Here's the conceit of Erwig's book: the idea of computer science, and some of its most fundamental constructs, are explained in a way that relates them to familiar stories. By explaining the concept of an algorithm by likening it to the famous tale of Hansel and Gretel, or explaining how a loop works by likening it to Harold Ramis and Bill Murray's Groundhog Day, Erwig seeks to establish an understanding of programming that a mere programming manual or textbook cannot hope to match. It is, after all, one thing to say "I want to learn to code"; it's another thing entirely to open up a book or do a Google search and not instantly become too overwhelmed to continue.

This sort of understanding is a fine goal, and his choice of pop culture texts to apply to computing's basic tenets is spot-on every time, both in terms of general public familiarity with the stories presented and in terms of how he applies those stories to code. While it's true that not everyone is going to know every story, Erwig ensures that even if you don't know the story, you get the basic idea of the part of that story that applies to the idea that he's talking about. For example, the first story that Erwig uses is Hansel and Gretel, which is his basis for teaching us about the very idea of an algorithm. Erwig wisely leaves the majority of the plot out of his discussion, focusing instead on the trail of breadcrumbs that Hansel leaves so that the pair may find their way back. Rather than bring the house they find, or the witch, or the reason their breadcrumbs didn't work into the discussion, Erwig's focus on the breadcrumbs allows him to focus on the definition of an algorithm.

In this case, of course, the "algorithm" is not comprised of the breadcrumbs themselves, but the thought processes that went into dropping them and the processes involved in following them back home. This distinction is important because it is that level of abstraction that allows us to apply those same principles to computer code. Erwig's clarity in this point is necessary and well-expressed.

The problems seep in with Erwig's choice of language. He's a professor at Oregon State, and for better or worse, he writes like a professor.

In one of the book's final chapters, Erwig is using Harry Potter to introduce us to the basics of Object Oriented programming. He introduces a segment on typing rules like this:

In addition to supporting the efficient derivation of information about particular objects, types enable reasoning about the interaction of objects and thus provide a way to make predictions about the world. This can be achieved through a set of rules, called typing rules, that describe whether and how objects of different types can interact.

At heart, there's nothing wrong with Erwig's writing here. It makes its point, it's clear, it's straightforward. It's also dry and academic. The appeal in the idea of a book like Once Upon an Algorithm lies in the potential to make programming accessible, to make it feel less like a series of magical incantations known only by a select cadre of the mathematically minded, and more like something anyone could do. Erwig is a professor writing like a professor. While there may be a context in which that works, it's a style of writing that plays against the potential accessibility of the subject matter. It's definitely too heady for young readers, who might otherwise find some appeal in likening programming to familiar stories and films. It's likely too dry for many adults, who might be hoping for some personality to go with the appealing conceit. Sadly, the ideas are likely too basic for an academic looking for a deeper understanding of programming.

The only real potential destination that makes sense is an intro-to-programming class for first-year students. Placed alongside a more explicitly code-oriented programming textbook, Once Upon an Algorithm makes sense as a document of "why" when consumed with a document of "how". If this is a textbook, the student to whom it is assigned will have classwork-related reasons to push through the language and gain the understanding that Erwig is trying to pass along. Otherwise, it's difficult to see a reader sticking with it, despite the admittedly clever analogies on display.


The year in song reflected the state of the world around us. Here are the 70 songs that spoke to us this year.

70. The Horrors - "Machine"

On their fifth album V, the Horrors expand on the bright, psychedelic territory they explored with Luminous, anchoring the ten new tracks with retro synths and guitar fuzz freakouts. "Machine" is the delicious outlier and the most vitriolic cut on the record, with Faris Badwan belting out accusations to the song's subject, who may even be us. The concept of alienation is nothing new, but here the Brits incorporate a beautiful metaphor of an insect trapped in amber as an illustration of the human caught within modernity. Whether our trappings are technological, psychological, or something else entirely makes the statement all the more chilling. - Tristan Kneschke

Keep reading... Show less

Electronic music is one of the broadest-reaching genres by design, and 2017 highlights that as well as any other year on record. These are the 20 best albums.

20. Vitalic - Voyager (Citizen)

Pascal Arbez-Nicolas (a.k.a. Vitalic) made waves in the French Touch electro-house scene with his 2005 debut, OK Cowboy, which had a hard-hitting maximalist sound, but several albums later, Voyager finds him launching into realms beyond at his own speed. The quirky, wallflower vocals and guitar snippets employed throughout Voyager drop a funk that brings to mind WhoMadeWho or Matthew Dear if they had disco-pop injected between their toes. "Levitation" is as pure a slice of dance floor motivation as theoretically possible, a sci-fi gunfight with a cracking house beat sure to please his oldest fans, yet the album-as-form is equally effective in its more contemplative moments, like when Miss Kitten's vocals bring an ethereal dispassion to "Hans Is Driving" to balance out its somber vocoder or the heartfelt cover of "Don't Leave Me Now" by Supertramp. Voyager may infect you with a futuristic form of Saturday Night Fever, but afterwards, it gives you a hearty dose of aural acetaminophen to break it. - Alan Ranta

Keep reading... Show less

Hitchcock, 'Psycho', and '78/52: Hitchcock's Shower Scene'

Alfred Hitchock and Janet Leigh on the set of Psycho (courtesy of Dogwoof)

"... [Psycho] broke every taboo you could possibly think of, it reinvented the language of film and revolutionised what you could do with a story on a very precise level. It also fundamentally and profoundly changed the ritual of movie going," says 78/52 director, Alexandre O. Philippe.

The title of Alexandre O. Philippe's 78/52: Hitchcock's Shower Scene (2017) denotes the 78 set-ups and the 52 cuts across a full week of shooting for Psycho's (1960) famous shower scene. Known for The People vs. George Lucas (2010), The Life and Times of Paul the Psychic Octopus (2012) and Doc of the Dead (2014), Philippe's exploration of a singular moment is a conversational one, featuring interviews with Walter Murch, Peter Bogdanovich, Guillermo del Toro, Jamie Lee Curtis, Osgood Perkins, Danny Elfman, Eli Roth, Elijah Wood, Bret Easton Ellis, Karyn Kusama, Neil Marshall, Richard Stanley and Marli Renfro, body double for Janet Leigh.

Keep reading... Show less

The Force, which details the Oakland Police Department's recent reform efforts, is best viewed as a complimentary work to prior Black Lives Matter documentaries, such 2017's Whose Streets? and The Blood Is at the Doorstep.

Peter Nicks' documentary The Force examines the Oakland Police Department's recent reform efforts to curb its history of excessive police force and systemic civil rights violations, which have warranted federal government oversight of the Department since 2003. Although it has its imperfections, The Force stands out for its uniquely equitable treatment of law enforcement as a complex organism necessitating difficult incremental changes.

Keep reading... Show less

Mary Poppins, Mrs. Gamp, Egyptian deities, a Japanese umbrella spirit, and a supporting cast of hundreds of brollies fill Marion Rankine's lively history.

"What can go up a chimney down but can't go down a chimney up?" Marion Rankine begins her wide-ranging survey of the umbrella and its significance with this riddle. It nicely establishes her theme: just as umbrellas undergo, in the everyday use of them, a transformation, so too looking at this familiar, even forgettable object from multiple perspectives transforms our view of it.

Keep reading... Show less
Pop Ten
Mixed Media
PM Picks

© 1999-2017 All rights reserved.
Popmatters is wholly independently owned and operated.