Thursday, August 18, 2011

Online Book Review: Learn Ruby the Hard Way

First of all, I love the title of this “book”, and I love the concept behind it. Zed Shaw originally wrote this for Python, in a book called "Learn Python the Hard Way". Rob Sobers made a language equivalent conversion/translation to Ruby. Rob is quick to point out that, while he has made the conversion to Ruby, and has made the book relevant to Ruby programmers, the concept and approach is still Zed's.

Zed (and Rob) have written something noteworthy, a shot across the bow to anyone who laments the loss of the “old ways”. When I talk about the old ways, I’m referring to the old books and magazines where those who wanted to run the programs had no choice but to type out the lines verbatim from the pages from the books or magazines, run them, figure out where we messed up, and ultimately get them to run.

From Learn Python the Hard Way:

The Hard Way Is Easier


LPTHW emphasizes precision, attention to detail, and persistence by requiring you to type each exercise (no copy-paste!) and make it run, as well as to read up on outside topics and to return to exercises and ideas that you don't understand, and understand them.


At the end of LPTHW, you'll know the basics of coding, and be ready to move on to more challenging books. Or at least you'll have tried something new.

The ability to have books and texts online is wonderfully convenient, and the ability to cut and paste code in quickly is a great advancement… but it comes at a cost. Cut and paste helps us to get the ideas down quickly and see them in action, but there just isn’t a replacement for “muscle memory”, the long and often arduous process of typing out the lines of code, forcing us to slow down and physically, manually mull over those lines. I sometimes laugh about the fact that I still remember shell programming tips I learned 20 years ago, but I can barely remember things I did in intense Java study sessions just a couple of years ago. Why is that? It’s because I had to type out every single one of those shell programming examples. There was no CD-ROM, there was no “web site” to download code from. It was type or do without.

Learn Ruby the Hard Way” expects the programmer to do exactly the same thing. The explicit first instruction is to type in the examples, verbatim, and no cheating. No copy/paste, no macros, and no advanced IDE (they do recommend using gedit as an IDE and it’s very basic and straightforward, very few bells and whistles). There are over 50 exercises, many of them long, repetitive and tedious… and that’s awesome! I’m totally serious here! Especially for us testers. We often try to find the quickest way to accomplish a step or a process when it comes to programming (because, come on, we’re not programmers, we’re testers, we don’t have time for this stuff, right?). Well, the more time I spend with this cumbersome and tedious system, the more appreciation I have for it. There’s no quick gains here, there’s no fast “a-Ha!” moment, and yes, occasionally I roll my eyes at the “master of the obviousness” of a lot of the examples. But there’s definitely a method to the madness here. This isn’t a platitude and concept book, this is a workout book. There’s a lot of code, there’s a lot of questions, there’s a lot of extra credit, and there’s a lot of time to be spent soaking in this stuff. The more that I mess with “code”; be it Cucumber, RSpec or general Ruby, there just isn’t any better method to learning it than just the raw doing it, over and over and over again.

So for those who have gone through a number of the commercial books and feel, yeah, OK, but am I really getting this, I recommend giving “Learn Ruby the Hard Way” a good and vigorous look. If you get irritated and fed up with it, sit back and allow yourself a smile, because that’s a good sign that it’s actually doing what it’s supposed to. It’s the hard way, as the title implies, but sometimes it’s the hard ways that prove to be the best ways :).

6 comments:

Philk said...

I'm about to start on this - will post a review on my blog once I'm underway. ( hmm, now there's a bold boast to make sure I follow through )
Have you started/finished it ?

Michael Larsen said...

Started, and I am in the low middle portion of it. Will write a follow-up when I am done :).

Tal. E said...

great, thanks!
btw did you finish it yet?

Michael Larsen said...

@Tal, I'm at the mid point at the moment. Again, it's well structured, and it feels a lot like working through a Math book, but I'll give them credit, it really does stop and make you think about what you are doing. I'll post a follow-up report when I'm done :).

Jeff said...

Are any of the extra credit answers posted online? I am stuck on exercise 21's extra credit.

Michael Larsen said...

Hi Jeff, I have not seen any of the extra credit options posted online as of yet. My guess is that if there were, they would be for the Python examples,as that's the original book. the Ruby examples if made may come later.