Review: Why's (Poignant) Guide to Ruby

Out of an anal-retentive desire to put as much of my output in a central place under my control, I’ve added and appropriately back-dated a bunch of old book reviews I like and still agree with to this blog. This was going to be one of them, but I ended up expanding it enough that back-dating felt dishonest.

Why’s Poignant Guide to Ruby, available for free on this lovely domain hack, is the strangest book about programming you’ll ever read, combining instructional writing on use of the Ruby scripting language with whimsical1 stories and cartoon strips about foxes. The programming doesn’t even start until Chapter 3.

It was written by why the lucky stiff (_why for short), a colourful character in the Ruby programming community who prolifically published code and programming tutorials starting in 2005 and ending in 2009, when he suddenly, mysteriously deleted everything and disappeared from the internet. His many projects were all stamped with his signature whimsical style that emphasised fun and creativity in programming.

Poignant Guide inspired a number of other works, like Learn You a Haskell for Great Good! and Learn You Some Erlang for Great Good! However, while these books imitate _why’s wacky cartoons, they mostly dispense with the random-stream-of-whimsy storytelling, perhaps for the best. This book is almost too quirky. Despite some strong elements, the whimsical stories ultimately become incoherent, and I think it would be a better book if _why had just toned down the frantic imagination a little and woven the stories more slowly: I can get behind a lot of the individual elements: adventurous Dr Cham and the goat, the organ instructor’s lottery, and definitely Dwemthy’s Array, but they’re packed with so much whimsical detail that it becomes quite overwhelming.

I love the ideas behind the book, and the union it draws between art and creativity and programming and logic – there’s a false dichotomy of creatives vs. logicals, artists vs. programmers that I have never felt comfortably on either side of. It’s enough that something like this exists to show how fun and creative programming should be.

I love the way that, for example, this bit of story from Chapter 6 just drops into tutorial mode with no fan-fare.

“Stop hitting me!” screamed the littlest fox. “I’ve almost figured out this one with the dots on it!!”

Suddenly, with great precision and without warning, Fox Tall grabbed the monkey’s nose and slammed his face down against the counter. The pens and inkpads on its surface rattled and “Bam!” said the fox. The gorilla’s eyes spun sleepily as his arms… then his neck… then his head slithered to the floor behind the counter.

Here are a few more global variables you might care to use:

irb> $/      # The $/ is the line separator, it is normally set to \n, which represents _Enter_
  => "\n"    # or "end of line".  The slash represents a sword slashing lines in a file.

The book also taught me a couple of new Ruby tricks – I previously had no idea about most of the crazy useful global variables. The book doesn’t really have any practical code examples, unless you have a real use-case for umop-apisdn fxaf. Should it? Well, no – I think the point is just to have fun doing silly stuff with code (something Ruby is very good for). But I do wonder how accessible it is as an educational resource.

Particularly in the earlier chapters, Poignant Guide seems like it’s concerned with teaching people new to programming, using vivid metaphors for different bits of syntax – an array, [1,2,3,4], is a caterpillar between two staples (the commas are its legs). But even from the beginning the examples have a programmer mindset that’s intimate with directory structures and file names, and that’s very fastidious and precise about chopping up strings of text and manipulating them, always mindful of whitespace and linebreaks – a brain that already thinks like a compiler. So I’m not sure I’d recommend this book as a programming introduction, which is a bit of a shame. But then you probably shouldn’t learn Ruby as a first language anyway, if only because it’ll spoil you for anything else with all its syntactic sugar and custom loop functions.

The book also claims to want to make the reader cry – hence the “poignant” in the title. Perhaps my heart is made of stone, but I didn’t shed a single tear while reading this programming manual. Still, it’s a fun read, though probably best for someone who already knows some programming, wants to get into Ruby and has a high tolerance for whimsy.

  1. Content warning: this article overuses the world “whimsical”. ↩︎

similar posts