Chapter 3. Refactoring—By Example

In Chapter 1 and Chapter 2, we briefly touched on the subject of refactoring. This chapter gives a detailed treatment of this topic because refactoring is one of the fundamental aspects of test-driven development and a very useful practice in its own right.

Refactoring is an activity aimed at improving the internal structure of existing-code without making externally visible changes to the functionality. Why would such changes be useful? (After all, there is an age-old engineering adage: "If it ain’t broke, don’t fix it.") Are we suggesting fixing a problem that does not exist? Is refactoring just another way to waste your time and money? The simple answer is no.

Note

Refactoring is a long-term, cost-efficient, and ...

Get Test-Driven Development in Microsoft® .NET 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.