"Programming Ruby: The Pragmatic Programmers' Guide, Second Edition," by Dave Thomas with Chad Fowler and Andy Hunt

Pros: Breadth, Depth, and Clarity
Cons: API Reference Tonnage
Rating: 4 out of 5

Technorati Tags: , , , , , ,

My first thought upon hearing about Ruby was: “Meh.” The world is already well-populated with scripting languages, why add another one? Why, indeed. Dave Thomas and his co-authors provide the answer in their pragmatic programmers’ guide to Ruby. One of the best features of this book is the frequent contrasts with other languages. Whether you are a native of Perlistan, Javanesia, or The People’s Republic of C, the book clearly illustrates the similarities, differences, and near-smiliar pitfalls of Ruby. These are invaluable passages both in learning the language and deciding whether to use it.

Ruby has all the usual features one would expect from a scripting language. It’s dynamically typed – in fact, it’s “duck-typed” meaning that if an object walks and talks like a duck, it can be treated like one; objects are typed in terms of whether they can answer the messages sent to them. The language also includes primitives supporting regular expressions and interpolation. These features are common to other languages, though, and don’t present too much of a challenge for technical writers — anyone without a good idea of how to teach regular expressions can pick up several books on the subject.

However, there are some less common features that require more delicate treatment. Ruby has first class support for functions. Functions can be assigned to variables, passed to other functions or blocks, created anonymously using lambda. This makes for some very powerful forms of expression in a language. Honestly, I haven’t worked with a language that had genuine closures since I used Scheme (a lisp dialect). This is non-trivial stuff; in fact, it was the part of the course back in school that convinced a lot of people they didn’t want to be in computer science after all. Dave Thomas and company do an admirable job of making functional programming using Ruby’s syntax approachable and fun.

There were a few areas with which I had a little more trouble. I found some of chapter 24, particularly metaclasses and virtual classes, to be a little hard to follow. The concepts will be familiar if you’ve worked with other languages with a good meta-object protocol. However, it did take me a bit of puzzling over the text to pull the meaning from it.

Another thing I liked about the book was the coverage of topics above and beyond the language itself. The authors cover the ruby tool set, including the interpreter, documentation generation tool RDoc, and the gem packaging system. These tools are described in greater depth than I would’ve expected. For example, I would expect to read on the use of gem to install libraries, but the book also covers using gem to package and distribute code. The authors also touch on the use of Ruby for various applications, such as web scripting. These topics are often overlooked and sorely missed in introductory books.

My last complaint is that this is really two books in one. The first half of the book is a tutorial for learning Ruby. Most of the material in the first few chapters is repeated in chapter 22, though, and the latter half of the book is an API reference. This may be a good feature if you want an all-in-one tome, but I tend to want one or the other without lugging around both.

On the whole, I recommend “The Pickaxe.” For that matter, I recommend learning Ruby. Even if you don’t use it on the job, it’ll remind you how to think in ways that more programming languages should support.

Posted in Reviews

Leave a Reply

Your email address will not be published. Required fields are marked *


Stuff for Gamers

Take a look at the shirts-n-things in our stuff for gamers store.