DEV Community

Riccardo Odone
Riccardo Odone

Posted on • Originally published at

How to Terminate Legacy Code without Getting Stuck

You can keep reading here or jump to my blog to get the full experience, including the wonderful pink, blue and white palette.

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

Get the latest content via email from me personally. Reply with your thoughts. Let's learn from each other. Subscribe to my PinkLetter!

Top comments (0)