Way back in 1999 Martin Fowler published Refactoring — Improving the Design of Existing Code. Fowler’s book introduced the world to refactoring as an independent practice, and provides dozens of detailed mechanical recipes, each of which describes the steps needed to change one (usually small) aspect of a program’s design without breaking anything or changing any behavior.

To be skilled in refactoring is to be skilled not only in safely and gradually changing code’s design, but also in first recognizing where code needs improvement — recognition of code smells. This is where William Wake’s brilliant Refactoring Workbook (2003) comes in. Bill’s book focuses on Java code smells: Each chapter consists of descriptions of a few major code smells, followed by a number of exercises to work through (the challenges vary; some ask you to analyze code, others to assess a situation, still others to revise code).

But what if you’re not a Java developer? Good news: Early next year Jay Fields, Shane Harvie and Martin Fowler are publishing Refactoring, Ruby Edition. It’s available now as a Safari Rough Cut.

And as if that weren’t enough good news, Bill Wake and I are writing the Ruby Refactoring Workbook. Compared with Bill’s original Java Refactoring Workbook our Ruby edition will have a similar overall structure, but is otherwise a substantial re-write. We have retained the core code smells (and added a few more) and re-worked them to apply to Ruby’s more dynamic environment. We have replaced all of the code samples, and replaced or revised all of the exercises. We have also re-written much of the introductory material, mostly to reflect the rise in importance of test-driven development during the last five years. In short, we’re trying to create a stand-alone Ruby refactoring workbook for the modern developer, and not simply a Java book with Ruby code samples.

As things stand right now we have three chapters left to write, and a deadline to get the first draft to our publisher next month. I hope to start releasing draft text into the wild for comment fairly soon, so watch this space if you’d like to be involved!