Legacy code

There is code nobody wants to touch any more

The more a legacy module is avoided, the fewer people know it, and the less it is known, the riskier every change feels. New code piles up next to the old, which stays as it is. Hidden dependencies, missing tests and a debt that always loses to features hold the whole thing in place, so cleaning up that one module lasts only until the next change.

Book a call

Does this sound familiar?

  • Before touching certain modules, people ask the person who wrote them, and if that person is on holiday, they wait.
  • A small change breaks a feature in a completely different part of the system.
  • The team adds new code next to the old rather than changing it.
  • Those parts have no automated tests, so every change is checked by hand, slowly and without certainty.
  • Sooner or later someone on the team suggests rewriting everything.

What makes that code untouchable?

The chain often starts with missing tests. With no safety net, fixing that code is risky and loses out to features. The remaining debt tangles the modules together, and in the end only the people who wrote them know where it is safe to make a change.

  1. Modules tied together by invisible threads

    The costliest dependencies never show up in the imports. They run through the shared database, a cache, a convention everyone follows without ever having written it down. Anyone changing a module cannot know what it drags along, and that stays true until the boundaries between the parts follow those of the domain again.

  2. There is no test safety net under the old code

    Michael Feathers defines legacy code as code without tests. Without tests, the only way to find out whether a change broke something is to wait for it to happen. Characterisation tests pin down today’s behaviour, bugs included, and make it possible to work on code you do not yet fully understand.

  3. Only a few people really know it

    A part of the system that can only be understood by reading all of it ends up known by its author, while everyone else learns to steer around it. Every change goes through those people, who become the team’s bottleneck and its biggest risk on the day they leave.

  4. Debt always loses to features

    As long as nobody knows what it costs to leave that code as it is, fixing it remains a team request set against business requests, and it loses. Meanwhile every feature built on top makes it a little harder to change.

What changes when the code becomes changeable again

The old code becomes code like any other. You change it with tests behind you, a change touches the spot it needs to touch, and anyone on the team can pick it up. Refactoring becomes part of daily work and follows the roadmap in small steps, with no separate project.

When the author of a module is on holiday, the change that concerns it goes ahead anyway, and a feature that runs through that code is estimated like any other. Even the proposal to rewrite everything, if someone raises it again, is discussed with the tests in hand.

Which part of the code do you avoid?

The module you avoid says a lot. We work out with you whether refactoring that part is enough or whether a Technical Debt Assessment should come first.

We use your data to respond to your request. Read our Privacy Policy.