The Bottom Line
Refactoring: Ruby Edition by Jay Fields, Shane Harvie and Martin Fowler with Kent Beck is a reworking (or refactoring, if you will) of the book Refactoring: Improving the Design of Existing Code. Refactoring is considered the best (and first) work on the subject and is akin to a refactoring version the Gang of Four book on design patterns. More than just the same book with Java examples replaced with Ruby examples, Refactoring: Ruby Edition covers many Ruby-specific problems you may face with refactoring and is every bit as important as the original Refactoring title.
- Created from the seminal work on the subject
- No long-winded theoretical discussions
- Tight focus on practical examples and how refactoring can be applied to your code
- Sage advice from experienced programmers who defined what refactoring is
- Huge library of "Refactorings," or procedures to follow to successfully perform certain refactorings
- Nothing new for experienced programmers who already own the original Refactoring book
- Written for the professional programmer
- Ch. 1: A solid example of how refactoring can be useful and how it's applied.
- Ch. 2: History of refactoring, problems you'll face, why to refactor.
- Ch. 3: A list of symptoms of "code smell," which may indicate refactorings are needed.
- Ch. 4: Unit testing and how it related to refactoring.
- Ch. 6: Refactorings for composing and decomposing methods.
- Ch. 7: Refactorings for moving features between objects.
- Ch. 8: Refactorings for organizing data.
- Ch. 9: Refactorings for simplifying conditional expressions.
- Ch. 10: Refactorings for making method calls simpler.
- Ch. 11: Refactorings for dealing with generalization.
Guide Review - Refactoring: Ruby Edition
Refactoring: Ruby Edition is split into two major sections. The first section explains what refactoring is, how to apply refactorings, how do identify "code smell" and how to write tests to ensure refactorings didn't break anything.
The second part of this book is the real attraction. Chapters 6 through 12 are a gigantic, categorized list of refactorings, or procedures the follow to perform specific refactorings such as Extract Method or something as simple as Method Rename. There are about 300 pages of these refactorings, each with descriptions of what the refactoring will achieve, before and after UML diagrams, a motivation section describing why you'd want to perform this refactoring and a mechanics section, which is a step by step procedure for performing the refactoring.
The overall emphasis of this book is that of practicality. The first chapter kicks off with a practical example, complete with just the right amount of code for you to understand what refactoring is and how to use it. There are no overly-long theoretical discussions to slow you down.
The library of refactorings draw on years of experience from very skilled programmers. In particular, the mechanics sections of each refactoring will help you avoid problems you might have never seen coming. These chapters are worth their weight in gold.
In all, this is a hugely important book for Ruby programmers. Refactoring is an extremely common task in agile programming (the primary methodology for Ruby programmers), and the wisdom in this book is something that can't be missed. It should be considered required reading for all Ruby programmers.
There are only one reason you wouldn't want to read this book: you already own the first Refactoring title, and are experienced enough to convert the Java refactorings to Ruby. For everyone else, get this book and read it.