Chapter 2. The Refactoring Cycle
In this chapter, we’ll define refactoring and code smells. Then we’ll look at the fundamental cycle of how to improve code with refactoring. Rules for simple design will tell us when we’ve done enough. We’ll close with a look at how refactoring is a key part of test-driven development.
What Is Refactoring?
Refactoring is the art of safely improving the design of existing code. In Refactoring [14], Martin Fowler describes it thus:
“Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.”
This has a few implications:
• Refactoring does not include just any changes in a system: Although refactoring should ...
Get Refactoring in Ruby now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.