Review of Practical Object-Oriented Design in Ruby

I did a review of the book Practical Object-Oriented Design in Ruby: An Agile Primer  by Sandi Metz. Here it is below.

In her afterword, she writes: “…if this book has achieved its goal, you think differently about objects now than when you first began.” This book did make me think about object differently. For the most part, very little in this book was new to me, but it did present things in a new way.

Maybe it is due to years of ORM frameworks, but I had thought of objects primarily in terms of their data fields, and the methods are there to control how they are manipulated. Sort of like a C struct and functions in one file.

She repeatedly states that we should think of objects in terms of the messages that they can receive. The data seems to be secondary.

The book mentions design patterns, but does not spend much time on them. She mentions the SOLID principles explicitly a few times, and some of the book’s chapters cover a SOLID principle.

There is also a chapter on testing. I have used RSpec, and the book uses MiniTest. I thought that because of that I would not get much out of that chapter, but I was wrong. There is a lot of good information in this chapter as well. Another interesting perspective that I got from the testing chapter is the the point of testing is not to reduce bugs or to document, but to reduce cost.

She gives a lot of rules and principles throughout the text, and also says that they are general guidelines. If you are in a situation that requires

This book might be a bit much for someone new to Ruby or OO programming, but if you have been doing Ruby and/or OO for a while, I think this book is worth it. You might not learn something new, but you will probably see things differently, which can be just as useful.

 

Image from a 13th century manuscript housed at The Walters Art Museum, manuscript information here, image from World Document Library, image assumed allowed under Fair Use.