Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

A Review of “Eloquent Ruby” by Russ Olsen – It Rocks!

By Peter Cooper / February 27, 2011

Eloquent Ruby ( - print & Kindle) by Russ Olsen is the first Ruby book I've read in its entirety within 24 hours; it's that good. That may be all you need to know before you buy a copy at, or read it on Safari (if you have an account). If you want to learn more though, keep reading.

What Is "Eloquent Ruby"?

Eloquent Ruby is a book published by Addison Wesley and written by Russ Olsen (who also wrote Design Patterns in Ruby a few years ago). It clocks in at around 400 pages and has 31 chapters clocking in at around a punchy 10 pages each. Each chapter is titled as a guideline you should follow to write "eloquent" Ruby - things like Create Classes That Understand Equality and Write Code That Looks Like Ruby - and typically the claim is explained, some code examples shown and discussed, some real world examples pointed to, and that's it.

As with Design Patterns in Ruby, Russ adopts a chatty, familiar tone. Reading this book is like reading a book specifically written for you by a friend. He doesn't shoot off on many unnecessary tangents and he keeps the stories short and sweet but this book certainly couldn't be called dry.

The book is also notably short of egregious errors or omissions. Even when I don't read something with a fine-toothed comb on standby, I can usually pick out a laundry list of factual and grammatical errors or omissions (as both Obie Fernandez and my wife will attest) but Eloquent Ruby gave me little to chew on. I can only bring to mind a few spacing and formatting issues and only one true "error": a > instead of a < in a class definition on a single example.

Russ tries to remain neutral with his choice of Ruby implementations but the book seems to focus primarily on Ruby 1.9 (Ruby 1.9.1 specifically but that's just due to when he wrote it) while providing useful footnotes in the cases where there are differences to Ruby 1.8. No matter what Ruby implementation you're using, there's little to confuse you as most of it is very non-implementation and non-version specific.

I wholeheartedly recommend this book to anyone except those who, well, could have written a similar book themselves. The short punchy chapters make it a delight to read and gives the option of reading it merely 10 minutes at a time before bed or similar. The short chapters also make it useful as a reference if you forget how to do a certain thing like, say, use method_missing, even though it's not put together as a reference book at all. Lastly, this book is a must read if you're not confident with Ruby idioms and the best way to structure and lay out your code - Russ's approaches reinforce the current "standard" way to write Ruby and this alone is worth the price of admission.

Who Should Buy It?

  • Any Ruby developer who doesn't yet feel like they're at guru level (that's most of us!)
  • Anyone who wants to get a feel for the typically undocumented style, syntax, and structural standards of top Ruby developers.

Who Shouldn't Buy It?

  • Anyone without a sense of humor or who doesn't like a chatty, familiar type of writing.
  • Matz, Dave Thomas, Chad Fowler, Russ Olsen himself, and a few others.
  • Anyone who's resistant to change and wants to keep coding Ruby "their way."

The Chapters

The chapter titles in Eloquent Ruby are useful enough to give you an indication of the level(s) it aims at and whether it would be interesting to you, so here goes:

  1. Write Code That Looks Like Ruby
  2. Choose The Right Control Structure
  3. Take Advantage Of Ruby's Smart Collections
  4. Take Advantage Of Ruby's Smart Strings
  5. Find The Right String With Regular Expressions
  6. Use Symbols To Stand For Something
  7. Treat Everything Like An Object - Because It Is
  8. Embrace Dynamic Typing
  9. Write Specs!
  10. Construct Your Classes From Short, Focused Methods
  11. Define Operators Respectfully
  12. Create Classes That Understand Equality
  13. Get The Behavior You Need With Singleton And Class Methods
  14. Use Class Instance Variables
  15. Use Modules As Name spaces
  16. Use Modules As Mixins
  17. Use Blocks To Iterate
  18. Execute Around With A Block
  19. Save Blocks To Execute Later
  20. Use Hooks To Keep Your Program Informed
  21. Use method_missing For Flexible Error Handling
  22. Use method_missing For Delegation
  23. Use method_missing To Build Flexible APIs
  24. Update Existing Classes With Monkey Patching
  25. Create Self Modifying Classes
  26. Create Classes That Modify Their Subclasses
  27. Invent Internal DSLs
  28. Build External DSLs For Flexible Syntax
  29. Package Your Programs As Gems
  30. Know Your Ruby Implementation
  31. Keep An Open Mind To Go With Those Open Classes

There's something for everyone and it gets progressively more advanced.

How to Get Eloquent Ruby

If you want a print or Kindle copy, head to,, or your other favorite book retailer. If a PDF or EPUB file is more to your taste, InformIT has those for sale (currently for $28.79).

Kindle Preview


  1. Pauli says:

    "resilient to change"

    Buying it now. Thanks!

  2. Will says:

    Looks yummy! Buying it right away!

  3. Dominik Honnef says:

    Okay, I just spend my Sunday reading the book, and this is my honest opinion:

    "Any Ruby developer who doesn't yet feel like they're at guru level [should buy it]" is nothing but an extreme exaggeration. I am by no means anywhere near "guru level" but from the several hundreds of pages, I learned exactly one thing and that was a rather subtle aspect of blocks. Everything else wasn't news to me and I seriously doubt that name spaces, mix-ins or the splat operator are things that only gurus know of.

    Don't get me wrong, I think that the book is an excellent addition to the Pickaxe, but it really targets novices, not people who just wouldn't call themselves gurus.

    One part of the book did, however, honestly disappoint me: the section about writing your own gems. I thought that by now we should've come to the conclusion that a) the gemspec belongs into your .gemspec file, not your Rakefile b) that there is absolutely no need for `File.expand_path(File.dirname(__FILE__))` in your require statements. Rubygems sets up your load paths just fine to allow a simple `require "mygem/some_file"`.

    So what I am trying to say is: Even if you're not a guru, as long as you're not relatively new to Ruby, this book is not worth your money – the basics about style (2 spaces and no tabs, etc) are covered by many "styleguides" that are so prominent on github, and everything else is neither advanced nor new to you if you've written one or another application in Ruby.

    If you, however, just started learning Ruby, this book is definitely a nice addition to the Pickaxe.

  4. Mark Wilden says:

    I got it and I already disagree with his reasons in favor of using parentheses and against using, but it's still a very entertaining and at times thought-provoking read even for a veteran Ruby developer.

  5. Nathan Youngman says:

    I've been reading Eloquent Ruby this weekend, now on chapter 20. Individual chapters aren't too long, and the writing style makes it easy to say "just one more (page) turn." Though it will depend on your level of Ruby experience, I didn't find much to glean from the first ~10 chapters.

    The chapter on equality was good... so this is why their are 4 different ways to determine equality! Also surprising to find examples of @@ vertical globals being useful (URI Module). Overall feeling a little more comfortable with Ruby's eccentricities.

    Aside: I had pre-ordered the book from InformIT, with a unencumbered PDF for reference, and using kindlegen on the epub to read it on my Kindle. Code snippets are images in this case (from the epub). I'm guessing the Amazon version is different, as the advertised file size is significantly smaller.

  6. Peter Cooper says:

    @Mark: Regardless of the reason, in the past couple of years it's rare I've seen for .. in in code from the most experienced Rubyists. Except, notably, in ERB templates, though it seems to be fading away there too. This is an observation rather than a reason not to use it, of course.

    @Dominik: I spend a lot of time teaching beginners and my perspective of what beginner/intermediate/advanced is is perhaps rather different to yours. If nothing in this book particularly made you go "Ah!" or "Ooh, I forgot about that.." I suspect you are closer to "guru" level than you think! :-)

  7. Mike says:

    That was a great book review. Even if some may quibble with your conclusion, well done.

  8. John says:

    I'm about 2/3 way through the book, and it's a good one. I used to always recommend Programming Ruby, but now I'm thinking that an interesting path would be your Beginning Ruby followed by Eloquent Ruby, and then The Ruby Programming Language for the nitty-gritty and reference.

    One thing, though: There is at least one "egregious" error, and that's the discussion of a method called "block_supplied?" (instead of block_given?) (see p. 233). It's in the PDF and in the printed book. Only this spurious block_supplied? method is given in the index (i.e., no block_given?). Ouch. I would think the in-house technical reviewers would have to be have been asleep to have missed that one.

  9. Sand says:

    Definitely going on my Xmas list! No, birthday! That comes first. (Maybe Father's Day?)

  10. Pingback: Eloquent Ruby | Bitboxer

  11. Roland says:

    The book has some serious inconsistency with putting spaces before or after parenthesis () as in

    instance.method(arg, arg1 )
    def something( arg )

    imho the only widespred way in Ruby is to use no space in this case e.g.

    def something(arg)


    something(arg1, arg2).

Other Posts to Enjoy

Twitter Mentions