Appendix: Refactoring
Refactoring is a core technique for improving code. The canonical reference for refactoring is Martin Fowler’s book Refactoring: Improving the Design of Existing Code (Addison-Wesley, 1999). I refer you to that book for more information about the kind of refactoring you can do when you have tests in place in code.
In this chapter, I describe one key refactoring: Extract Method. It should give you a flavor of the mechanics involved in refactoring with tests.
Extract Method
Of all refactorings, Extract Method is perhaps the most useful. The idea behind Extract Method is that we can systematically break up large existing methods into smaller ones. When we do this, we make our code easier to understand. In addition, we can often ...
Get Working Effectively with Legacy Code 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.