Book Cover

So I read Practical Object Oriented Design in Ruby by Sandi Metz, which I found instructive in many areas and mildly lacking in others.

What I really liked in it was how it broke down class design and the theory of it. I was neither a large OOD fan, nor extremely cognizant of the reasons for its wide-spread use, but this book made me realize those reasons and like it. Objects are a way of contextualizing a problem or a situation into clearly defined constructs that behave logically. Seeing how the author broke down the example problems into object-oriented code felt extremely satisfying. I gained much insight into Ruby and how to design object oriented problems from it. It opened my mind to new ways of thinking about how to approach and break down unwieldy problems.

The area that I found that I had the most difficulty with was with ‘duck typing.’ Duck typing makes more sense to me now after reading the origin of its name and thinking about the lack of typing in Ruby and how that could be problematic in decoupling. From my understanding, it is using the behavior of the objects to pseudo-type them. Because in Ruby you don’t know if an object is of a particular class because there are no types. So you use duck typing to see if it ‘quacks’ like a duck and thereby infer that it is a duck. After reading that way of explaining it on the wikipedia page for it, it really clicks with what I glossed over in the book.

I think I will reread parts of it again in the areas that I felt hazy about the first time around. It appears to be one of those types of books that have consistent returns on reading it. It was written well too, so it isn’t that much of a hassle to skim over the sections again.