Facade retention: Retrofitting unit tests into legacy codebases

Facade retention is a construction technique that ensures the exterior of a building is retained while the rest is demolished and replaced.

I often use facade retention as an analogue with developers who want to start embracing TDD but don't know where to start with their existing projects.

Let's say you want to change or refactor a part of your system (the interior) but you want the behaviour (the facade) to remain the same. Unit tests are your facade retention - put it in place before you start, and they allow you to mess with the internals while giving you the confidence that the behaviour hasn't changed.

While this technique isn’t strictly TDD, it is a great way to get experience with test automation before taking the next step.

Previous
Previous

How to prepare for the February 1 2024 email changes by Google and Yahoo

Next
Next

The 2 most important tools for any software engineering team in 2024