9 min Read

Inheriting a Codebase Nobody Understands

Auditing legacy software to work out what is worth keeping, what has to go, and what a rebuild honestly costs.

Nikhil Sharma
Inheriting a Codebase Nobody Understands - Digital Solutions Ninja blog

Key takeaways

  • The question is never rebuild or keep, it is which parts of this are load bearing and which are scar tissue
  • A codebase nobody understands is usually a documentation and ownership failure long before it is a technical one
  • The riskiest code is not the ugliest, it is the part that touches money or customer data and has no tests
  • Full rewrites fail at a well documented rate because they have to reach feature parity with a system whose behaviour nobody has fully written down

The call usually starts the same way. There is a system running the business. The people who built it are gone. Something needs to change and nobody is confident about touching it.

The instinct in that moment is almost always to rebuild. It is also almost always wrong, and understanding why is most of the value of an audit.

What you are actually assessing

Not code quality. Quality is a poor proxy for risk and an even worse basis for spending decisions. What matters is narrower:

  • What is load bearing. Which parts, if they stopped, would stop the business today.
  • What is in the path of change. Which parts have to be touched for the things you actually want to do next.
  • Where the risk concentrates. Which parts touch money, personal data or anything with a legal obligation attached.
  • What is simply old. Which parts are unfashionable, stable, and can be left entirely alone.

That last category is bigger than people want it to be. A module written in a style nobody uses any more, which has not changed in four years and does its job, is not a problem. It is a solved problem that looks unfamiliar.

Why rewrites fail

A rewrite has to reach feature parity with the existing system before it can replace it. That sounds achievable until you notice that nobody has a complete description of what the existing system does.

The documented behaviour is a fraction of the real behaviour. The rest is accumulated: edge cases handled years ago for a customer who complained, a rounding decision someone made in a hurry, a workflow that only works because of a bug people have adapted to. All of it is now load bearing, and none of it is written down.

Meanwhile the old system keeps running and keeps needing changes, so you are maintaining two systems and shipping value in neither. This is the standard shape of the failure and it is very hard to recover from once it is underway.

The approach that survives contact

Put a stable interface in front of the old system, then replace behind it, one capability at a time, in the order the business actually needs.

This is slower to feel satisfying. There is no moment where the old thing dies and everyone celebrates. What there is instead is a sequence of changes that each deliver something, each of which can be stopped, and none of which require the business to hold its breath. Every one of these projects I have seen finish, finished this way.

What the audit produces

A useful audit hands over four things:

  • A map. What exists, what talks to what, and where the data lives. Most firms have never had this on one page.
  • A risk register. Ranked by business impact, not by code smell. What breaks, what it costs, how likely it is.
  • A sequence. What to do first, what that unblocks, and what can wait indefinitely.
  • A number. Against that sequence, phase by phase, with the assumptions written down.

If an audit produces a document that says the code is bad and should be rewritten, you have paid for an opinion you already had.

The thing to check before anything else

Access. Before assessing a line of code, confirm you control the repository, the hosting, the domain registrar, the database, the deployment pipeline and the third party accounts the system depends on.

I have seen firms discover, in the middle of a modernisation, that their production database was in a personal account belonging to a contractor who left in 2021. Code you can read is a manageable problem. Infrastructure you cannot reach is an emergency, and it is worth ten minutes of checking before anything else begins.

Where this leaves you

Most inherited systems are in better shape than the people who inherited them believe. What is usually missing is not quality but comprehension: nobody has read the whole thing recently and written down what they found.

That is a few weeks of work and it changes the conversation from an anxious one about rewriting to a specific one about sequence and cost. If you want that done properly, with a plan you own whether or not I build anything, that is an MVP Roadmap.

FAQ

Quick answers to the most common questions about this topic.

It depends on the size of the codebase and how much of it anyone still understands, which is why I do not quote one from a description. The honest number only appears once someone has actually read the repository. What I offer instead is a paid MVP Roadmap engagement: I review the code, assess what is worth keeping, and hand you a written plan with a real number attached. The plan is yours whether or not I do the work, and the fee is credited against the build if you go ahead.

How the MVP Roadmap works

Usually no, and the instinct to do so is the most expensive one in this situation. A rewrite has to reach parity with a system whose full behaviour is undocumented, including the accidental behaviour customers now depend on. Incremental replacement behind a stable interface is slower to feel satisfying and far more likely to finish.

No, but it changes the sequence. The first job becomes reconstructing intent from the code and the data rather than asking anyone. That is slower and entirely doable. What genuinely hurts is losing access to the infrastructure, the accounts or the deployment pipeline, which is a different and more urgent problem.

By what it costs to change and what it costs to be wrong. Code that is ugly, stable and rarely touched can sit there for years. Code that is clean but sits in the path of every new feature is worth attention. The ranking is by business impact of change, not by how the code looks.

For reading and summarising unfamiliar code, meaningfully yes. They are good at producing a first map of a repository and explaining what a module appears to do. They are not good at telling you which behaviour is intentional and which is a bug customers have adapted to, and that distinction is the whole job.

Nikhil Sharma

Written by

Nikhil Sharma

Founder, DigiBenders

Twelve years shipping software, five of them leading a studio in New Brunswick. I build the software and run the marketing around it, which is an unusual combination and the reason most of my work arrives by referral. One person accountable, and everything ends up in your name.

You read the thinking

Now tell me what you are actually building.

If this was useful, the call usually is too. You describe the problem, I tell you what it takes and whether I am the right person for it.

Thirty minutes, no pitch

Honest read, including when the answer is no

Replies within one business day

Book a strategy call30 min

Keep reading

More from the same desk.

What you walk away with

One instrument. You own it.

Nothing held hostage, nothing locked to a platform you cannot leave.

The codebase

Yours, in your repository

The infrastructure

Your accounts, your billing

The accounts

Registrar, analytics, ads

The documentation

Written for the next person