For many the idea of bringing design patterns to ruby is a terrifying one. Having taken refuge from over-engineered java projects (or for that matter, attempts to apply java engineering approaches to a somewhat dynamic language like PHP) the baggage that often goes along with design patterns isn’t what a recent convert is looking for. But as I mentioned in my last review of a design patterns volume, and series editor Obie Fernandez highlights in his foreword, design patterns don’t have to be used that way and maintain merit when used as a source of collective experience and shared language.
Russ Olsen’s book does a good job of stepping through the key patterns from the Gang of Four’s initial offering, showing how they can be applied to and simplified with Ruby, introducing along the way various uses of blocks, mix-ins, and other powerful features of the language that may be unfamiliar to newcomers. Each chapter highlights how the pattern can be used or abused, sounding a note of caution to dissuade unthinking embrace of every pattern between its covers. It’s clearly written with a nice balance of code to prose.
Towards the end of the book a couple of “new” patterns are offered, particularly “internal DSLs”, “meta-programming” and “convention over configuration.” Opinions differ over whether of those can really be considered patterns in the general sense of the term. Certainly those concepts are examples of a community gradually refining its approaches to common problems, but at least two of them are considerably more conceptual and abstract than most of the other patterns in the book. Perhaps the best way to understand them is as giving an insight into the working patterns of the ruby community approaches problems, and pointers to topics worthy of more exploration.
That usage of the final few chapters gives some indication of the probable audience for this book. It seems best suited to those who have dabbled with ruby but don’t yet have much experience. A general sense of syntax is all you’ll need going in, but you’ll come away with a much stronger sense of the language’s features than that. Similarly it’ll work well for those with a general sense of the major patterns but who could do with a refresher, maybe while transitioning from java or other “enterprisey” development to ruby.
While it won’t have the same general appeal of other titles in the series like The Ruby Way and The Rails Way, this is a handy volume in a series that is making strong contributions to the ruby book market.
Disclaimer: I was sent a copy of this book for review by the publisher. There were a few pages missing due to a printing defect so I wan’t able to read parts of chapters 13 or 14. You can find it at amazon US, amazon UK and all sorts of other places.