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

I need your help to make the blog awesome. Here's a survey. Since there are no required questions, you decide how much time to spend on it.

Support my work by tweeting this article! 🙏