I can’t even begin to imagine how difficult it would be to write a book covering such an in-depth topic as the Ruby Programming language. Add to that a target audience with a widely diverse range of skills and the tasks seems to be out right impossible. Fortunately for us mere mortals Russ Olsen has taken on this challenge and surpassed my high expectations in his second book, Eloquent Ruby.
The first part of the book is for the Ruby newbies, but takes an interesting deviation from most programming books. Instead of focusing simply on the syntax and language libraries, Eloquent Ruby focuses on the community aspect of the Ruby programming language. Each programming community has its own style and norms and without a lot of direction and practice, these style and norms can be difficult to learn. The Ruby community is heavily opinionated and Russ’s book does a great job of explaining these opinions and their manifestation in many Ruby codebases.
In Part Two of Eloquent Ruby, Olsen dives into the core concepts and building blocks of the Ruby programming language. This section of the book covers the everyday usage patterns and common best practices when working with Ruby’s classes, iterators, blocks, and modules.
The power and flexibility of Ruby is put on full display in Part Three of Russ’s book. Newcomers to Ruby are often mystified by Ruby code that appears to be doing magical things like dynamically adding methods to a class. In this section, Russ pulls back the curtain and explains the magic that is metaprogramming. Those unfamiliar with the concept may find the topic confusing at first, but Olsen breaks it down in a way that is easy to understand. This section thoroughly covers Ruby’s
method_missing hook and how to open classes to add your own customizations.
In the last section Russ ties a lot of the concepts of the book together through a discussion on how Ruby can be used to create Domain Specific Languages (DSLs). As a bonus Russ finishes the book with a chapter on how to package your code into a gem (Ruby library) and a chapter on the different Ruby Implementations.
At almost 400 pages I feared Eloquent Ruby would take a while to read, but I was pleasantly surprised at the pace at which I made it through the book. Even though the book was a quick read it still felt as if I had gained a lot of new knowledge after its completion. I credit the speed reading and depth of understanding to Olsen’s writing style. The book is broken up into 30 concise chapters that each focus on a specific topic. This makes the book’s information very easy to digest.
Following a similar pattern from his first book, Design Patterns in Ruby, each chapter of Eloquent Ruby describes code examples “In the Wild” where Olsen discusses code snippets from open source projects using the topics covered within that chapter. In my opinion giving “real world” code examples was a great way to prove the relevance of the information covered in the book. Overall, Eloquent Ruby was a great read and I’d highly recommend it to Rubyist at all skill levels.