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 I decided back-dating would be 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, which is probably for the best.
Poignant Guide is almost too quirky. Despite some strong elements, the whimsical stories get 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’ve all got so much compacted whimsical detail that it all gets a bit overwhelming after a while.
But 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 one 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.
And also I learned a couple new Ruby tricks, which was cool – I previously had no idea about most of the crazy useful global variables, for instance.
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 wonder how accessible it all is.
In some places, particularly 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.
- Content warning: this article overuses the world “whimsical”. ↩