The Ruby Way: Chapter 1 … bipolar
I just finished chapter 1 of “The Ruby Way” by Hal Fulton. I feel a little torn because it is simultaneously one of the worst chapters I have read, and also one of my favorites. I’ll start with the bad.
The editing is pretty bad. I came across a number of typos which make me wonder if anyone actually read it before going to print. On top of that, this is some seriously sloppy technical writing (kind of like this blog). New or alternative terms are introduced without note, examples are only explained by cryptic, embedded comments, and seemingly complex concepts are given no examples at all.
The one statement that stuck out for me was on page 5 where the author describes the is-a relationship:
The relationship between a class and its superclass is interesting and important; it is usually described as the is-a relationship, because a Square “is a” Rectangle, and a Rectangle “is a” Polygon, and so on.
Hal Fulton calls this chapter “our review of object-oriented programming and our whirlwind tour of the Ruby language” so besides the typos and sloppiness, I’ll give him a break. That’s really a lot to jam into one chapter of a book whose intended audience is assumed to basically know all that stuff.
It’s like a man page. It all makes perfect sense if you already know it.
So as my hesitation grew, I reached section 1.5, “Training Your Intuition: Things to Remember”. This is where, in my opinion, the author turns everything around. This is one of my favorite sections of a technical book I’ve read in a long time. It’s basically a somewhat random laundry list of Ruby idioms, gotchas, and nuggets of general wisdom. It reminds me of the best stuff you find in a FAQ when learning a new language. It reminds me of the lists I write for colleagues when I have to bring them up to speed on a new technology. It reminds me of how I felt the first time I read Effective C++ when I was too young and foolish to recognize that for the oxymoron it was. It’s all the stuff that you wish that a language manual would come out and tell you right away, but is completely missing or at least hidden between simplistic examples.
Great stuff. Anyway, at least he ended on a high note. Flipping through the rest of the recipe-style chapters of the book, I’m pretty confident I’ll find it invaluable specifically because it continues that laundry list style that for some reason appeals to me so much.
p.s. my “learning scala” project was a simple rules engine. For Ruby, I’m planning on a tcl interpreter. Hopefully, I can do it in less than 550 lines. Combining the speed of Ruby with the speed and expressiveness of Tcl … good times.