I’ve been quiet about my first couple weeks of Ruby class, but not because of anything having to do with the class itself. It’s been hot in Seattle: the inside thermostat has been regularly clocking in at 90, and the last thing I want touching me is a laptop. Or a cat. Or any item of fabric. I’ve also been sidelined by a nasty cold.

I am going to class and doing my homework though, because, priorities.

We’re using Chris Pine’s Learn to Program book, and I really like it. It’s a great teaching companion. For one, the book has great examples and challenge problems — they’re fun, whimsical, not too easy or difficult, and reinforce key ideas from the chapters. What’s more, they’re the type of programing challenges that a more advanced student could take and build on (make it better, make it live on the web, etc).

But the BIG thing he does and why this is a Chris Pine appreciation post is how he handles recursive programing.

In many programing classes, recursion is treated as A Big Deal and sometimes the instructor will make you go back and solve problems you already solved, but recursively this time. You’ll probably have to do a factorial. Through the course of trying to understand how a program can call itself, you may or may not get stuck in a brain loop that ends in expletives and alcohol.

But not Chris Pine.

Look how he skillfully disarms you going into the recursion chapter:

20150707_142731

This is just so brilliant, from the title of the chapter and on. First he’s like, you got this. Relax. Let’s just chat a little, one programmer to another.

And then he covers recursion, using a relevant example and–yes, a factorial. (He writes: “I’m feeling pretty rebellious, anyway, for not using factorials as my first recursion example, so look at this before the recursion police take me away:”) And then he gives a super cool video game example which I don’t wholly understand but it’s sure pretty to look at, and interesting enough that I’d like to figure it out.

***

If you’ve been reading this blog for a while, you might remember that my mother’s reaction to recursion was this: “I HATE recursive code.  It is unnatural.  It does not work in my head.  it sucks.”

I wonder if she would have had the same reaction given a kinder, more gentler introduction to it. So this is just to say: I see what you did there, Chris Pine. And I salute you, sir!

Into it? Buy the book. Good for beginners or anyone who needs a tune-up.