Tests fight legacy
Automated tests are the best tool to fight legacy code.
By having automated tests such as unit tests or behavioral tests, you are able to refactor legacy code effectively with confidence that little can be broken.
Badly written systems often consist of tightly coupled functions. One change to a function in one class may well break a function in a completely different class, leading to a domino effect of more classes being broken until the entire application is broken.
In order to decouple classes and follow practices such as the Single Responsibility Principle, refactoring must be carried out. Any refactoring effort must be sure not to break code elsewhere in an application.
This brings us onto the topic of test coverage: is it ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access