In 2007 Russ Olsen published Design Patterns in Ruby (US | UK | CA). Right around that time there were several other Ruby books hitting the shelves (as Rails was really reaching the peak of its popularity), however Olsen’s book managed to distinguish itself as a highly valuable resource for readers who wanted to better understand how to apply design patterns to Ruby programming (in an organic rather than dogmatic manner.)
Those who read the Gang of Four (US | UK | CA) several years before, may have expected a highly technical reference book with examples translated from C++ to Ruby (whenever patterns applied to Ruby as well). And in theory Olsen’s book was very much like that, as it was a list of 14 design patterns extracted from the Gang of Four and applied to Ruby.
In practice though, Design Patterns in Ruby really wasn’t anything like Design Patterns: Elements of Reusable Object-Oriented Software. To start with, it wasn’t much of a reference. It was more akin to a cookbook of recipes that related to the idiomatic use of Ruby patterns.
Upon starting that book, readers may have expected a cold, dry, tough-to-fully grasp treatment of the topic at hand. Instead they were greeted with a tone that was friendly and entertaining; you could read and absorb the whole thing in a matter of days. While some people may have thought this book was aimed only at Ruby experts, it turned out to be incredibly accessible to, and suitable for, Ruby beginners as well.
Eloquent Ruby (USA | UK | CA), Olsen’s newest book, doesn’t veer much from the same description. This time the focus is not on specific design patterns, but rather on the style and essence of Ruby as a whole.
In the three plus years that separate Olsen’s two books, we’ve witnessed the language and its community mature as we’ve moved away from Ruby 1.8, and we’ve seen plenty of new tools and idioms emerge. Eloquent Ruby tries to capture the essence of writing beautiful Ruby code in this modern idiomatic manner, by focusing on Ruby 1.9 (while providing footnotes for those who are still using 1.8).
There is a certain “Ruby way” of approaching problems and elements of style that reveals if a developer is an experienced Ruby programmer or not. This book will no doubt help you better understand not only the “how” but also the “why” of this distinctive Ruby way.
The 31 short chapters in Eloquent Ruby are logically organized and easy to follow, but can be read independently from one another, too. By focusing on practical examples, these chapters cover everything from basic style considerations to object oriented design, and delve into such topics as testing, metaprogramming, DSL, packaging and deploying gems, different Ruby implementations available, and monkey patching considerations.
This useful book assumes that its readers have a basic knowledge of Ruby, yet aren’t complete and total experts yet (and indeed such experienced Ruby users may not pick up too much new information from this book). For those who consider themselves to be novice to moderately well versed Ruby programmers, this book is a delightful read that’s likely to help you further your Ruby skill set considerably.
I would classify Eloquent Ruby as a “second Ruby book”, to be read after you’ve worked your way through a canonical introduction. Yet, if you’re a bright developer who’s coming from a different language, you may consider jumping right into it as your first Ruby book.
This great title is called “Eloquent Ruby”, but I feel it could just as easily have been called Idiomatic Ruby, Elegant Ruby, or Beautiful Ruby – as all of those descriptions fit it to a tee, too.
Book giveaway: I will randomly draw one person from among those who share (retweet) this review on Twitter, and personally ship that person a free copy of Eloquent Ruby. All you have to do to be entered in this giveaway is to tweet about this post. I will announce the winner tomorrow morning on my twitter account and in the comments below.