Refactoring: Improving the Design of Existing Code is a seminal 1999 book by Martin Fowler that codified the practice of restructuring code without changing its behavior. It transformed how developers think about improving code quality.
Core Concept
Refactoring is the process of changing a software system in ways that:
- Do not alter external behavior
- Improve internal structure
- Make the code easier to understand
- Reduce the cost of future changes
The Catalog
Fowler’s book provides a catalog of refactoring techniques, each with:
- A descriptive name
- Motivation for when to use it
- Step-by-step mechanics
- Code examples before and after
Classic Refactorings
Notable techniques from the book:
- Extract Method: Pull code into a named function
- Rename Variable: Make names communicate intent
- Replace Conditional with Polymorphism: Use objects instead of if-else
- Move Method: Put behavior where the data lives
Impact on Software Development
The book influenced:
- IDE refactoring tools (IntelliJ, Eclipse, VS Code)
- Test-driven development (refactor step in red-green-refactor)
- Agile practices emphasizing continuous improvement
- Code review culture focused on maintainability
Legacy
Refactoring gave developers a shared vocabulary for code improvement and validated the practice as a professional discipline. The second edition (2018) updated examples to JavaScript for modern relevance.