How to Terminate Legacy Code without Getting Stuck

Posted on November 11, 2020 by Riccardo

Legacy and greenfield projects are two different beasts. Both require coding, but different rules apply. Failing to make the mental switch is an excellent recipe for getting stuck.

Some developers are perfectionists. But all of us have a minimum level of decency. We would never push bad code according to our definition of quality and skills.

Having an eye for good code is great in greenfield situations where the lack of constraints allows crafting software with finesse.

However, legacy code sits way below our minimum decency level and would require too much work to rewrite. We cannot undo months of accrued technical debt in a few days. And we shouldn't even try.

In this situation, we should embrace the inversion principle. Instead of trying to reach success, we should strive to avoid failure. Rather than repaying all the technical debt, we should just make it less awful.

Legacy code is not created all the same. Some never change and should be left alone. Some require multiple interventions. Don't try to make it perfect; just make it less awful for the next round of changes.

You will be back.

I'll be back

PinkLetter

It's one of the selected few I follow every week – Mateusz

Tired of RELEARNING webdev stuff?

  • A 100+ page book with the best links I curated over the years
  • An email once a week full of timeless software wisdom
  • Your recommended weekly dose of pink
  • Try before you buy? Check the archives.