Sitting on my desk at work is a copy of trusty the old GoF book. Whenever a new programmer asked me about patterns, that was the book I would hand him. The next time, I think I’ll hand him Design Patterns in Ruby instead. One reason is because I take any chance I can to introduce developers to Ruby, but the main reason is that Russ Olsen does a great job of describing commonly used patterns.
Each pattern description is concise and easy to understand. The code samples lean towards simplistic, but are more then adequate for demonstrating the technique being described. Olsen starts with a code example that resembles how the implementation was describe in GoF. He then morphs the pattern into a more Ruby-ish implementation. Along the way he makes sure to describe the pros and cons of each implementation.
In addition to covering fourteen of the GoF patterns, the book also covers three additional patterns that are popular in the Ruby community. Those are Domain Specific Languages, Convention Over Configuration, and Creating Custom Objects with Meta-programming. Again, the pattern descriptions are clear and the code examples nicely demonstrate the concepts.
If you’re just getting started a developer, and you’re interested in seeing what patterns are all about, Design Patterns in Ruby is a good place to start. If you’re already familiar with patterns, but not so familiar with Ruby, this book gives some good examples of how using Ruby impacts the patterns you’re already familiar. Even if you’re an experienced Rubyist, you may want to pick it up anyway. It’s a quick read and a nice book to have in your lending library.