Applying the legacy code change algorithm

To apply this algorithm, we usually start with a suite of tests and always keep it green while refactoring. This is different from the normal cycle of TDD because refactoring should not introduce any new features (that is, it should not write any new specifications).

To better explain the algorithm, imagine that we received the following change request: To greet my employees in a more informal way, I want to send them a tweet instead of an email.

Get Test-Driven Java Development - Second Edition 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.