DEV Community

Riccardo Odone
Riccardo Odone

Posted on • Edited on • Originally published at odone.me

3

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!

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay