Meditations on programming, startups, and technology
New Relic

Eloquent Ruby Review

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.


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

receive my posts by email

6 Responses to “Eloquent Ruby Review”

  1. Lonny Eachus says:

    Maybe it could have been worded a bit differently, since according to the charts Rails has not yet reached its “peak of popularity”.

  2. felix says:

    thanks for the review. In your ruby books posts, you had mentioned ruby best practices as a “lays out a clear road map to Ruby mastery for those who wish to pursue it.” Could you please tell, where does eloquent ruby stands? Beginner, Intermediate, Some experience?

    thanks

    • The ideal reader would be someone who has already read a book on Ruby and has used it for a while (e.g., a year). In practice, anyone from novice to intermediate will find the book to be useful. It’s a great one.

  3. Ruby 1.9.2 has chosen Doug Sparling (@scriptrunner) as the winner of a copy of Eloquent Ruby.

  4. Thanks Antonio! I fit the bill :) Actually, I just started back into Ruby and RoR development full time (I’d done RoR for two or three years previously, but had a small break where I was doing other work – Python, PHP, Java, etc…it’s GREAT to be back) and I know the book will be a great read. I will definitely recommend it to the junior devs in the office.

Leave a Reply

I sincerely welcome and appreciate your comments, whether in agreement or dissenting with my article. However, trolling will not be tolerated. Comments are automatically closed 15 days after the publication of each article.

*

Copyright © 2005-2012 Antonio Cangiano. All rights reserved.