- ISBN: 978-1-934356-47
- Publisher: Pragmatic Bookshelf
- Publication Date: February 2010
- Pages: 240
- Price: £25.50
The Pragmatic Programmers series of books form a well considered resource for more experienced developers looking to expand their knowledge of specific technologies or languages. Metaprogramming Ruby falls firmly into this category.
Wikipedia defines metaprogramming as 'the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime'. And it is these features that the book sets out to explore, taking in the object model, scopes and eigenclasses.
The bulk of the book consists of a dialogue between a team of developers, solving a set of programming problems. This mechanism allows the author to introduce a large number of Ruby language features and design patterns in a fairly informal and natural fashion.
Each section finishes with a series of structured problems, designed to re-enforce the topics covered in the section, before moving on to the next area.
The back third of the book takes the form of a more traditionally structured discussion of how to apply the techniques covered in the first part to Rails, the popular ruby based web framework.
This is not a book to learn ruby from. The author assumes basic to intermediate knowledge of ruby, and launches straight into the discussion of how to use and manipulate the full range of language features grouped under the 'metaprograming' label. This allows the book to cover a lot of ground, but is not for the inexperienced.
The book, due to its narrative-style is also not so useful as a reference. The author goes to some length to number each concept and design pattern, which he reviews at the end of the book, but this mostly leads to a lot of jumping around the book if you're interested in re-covering a specific area.
The book however does succeed in offering the reader inspiration to push the boundaries of their approach to programming in ruby, and think about solving real world problems using the concepts of metaprogramming and Domain Specific Languages, and as such it is definitely a useful addition to any ruby programmer's bookshelf.