Lars Tesmer's Blog

From Journeyman to Master - A Software Craftsman's Blog

Review: Eloquent Ruby by Russ Olsen

If you want to learn Ruby and you already know another programming language, Eloquent Ruby by Russ Olsen is a book you absolutely should read. Heck, even if you do not want to learn Ruby, you might want to read it because, who knows, it might give you ideas for the programming language you currently use.

So, why do I think this way?

For starters, this book is really well written, it never gets boring, it isn’t a dry explanation of yet another programming language – it’s simply an enjoyable read.

More importantly, it doesn’t suffer from the mistake of oh so many other books:
As an experienced programmer it’s really painful having to suffer through chapter after chapter explaining, for example, what an if-statement is, or that there are such things as, gasp!, loops.

In Eloquent Ruby there’s none of that. Or when there is, it’s written in a way that’s not treating you like a programmer on his first day.
Eloquent Ruby does not only teach you the syntax but teaches you idiomatic Ruby, so you’ll be able to write Ruby that actually looks like Ruby.

The book consists of four large sections. The first section introduces you to the basics of Ruby, the second deals about the possibilities offered by classes, modules and blocks in Ruby.
The third section is where it gets really meaty, you’re introduced to the power (and dangers) of metaprogramming. The final section is about pulling everything you’ve learned so far together, e.g. by showing how to build both internal and external DSLs with Ruby.

I really like the way each chapter is structured:
Every chapter first teaches you to the basic concepts of the topic at hand, giving lots of code examples.
More importantly, each chapters closes with the same three subsections:

  • In the Wild
  • Staying Out of Trouble and
  • Wrapping up

In the Wild features real world examples, using the concepts you’ve been familiarized with in the previous subsections of the chapter code taken from actually existing software.
Staying Out of Trouble helps you to avoid any pitfalls you could fall into when applying the stuff you’ve just learned. I’ve found those sections to be especially useful.
Wrapping up does what its name suggests: Summing up what’s been covered in the current chapter in a mere paragraph, allowing you to review what you’ve just learned.

In conclusion, if you’re an aspiring Ruby programmer, do yourself a favour and get this most excellent book. And while you’re at it, check out the equally excellent Ruby Best Practices by Gregory T. Brown, too! :D