Code is a liability: why deleting code can add value

AI-generated image for Orbitant's blog illustrating the premise that code is a liability, featuring a classic metal balance scale against a dark background, with four small translucent cyan glass spheres on the left pan and a single larger glowing sphere on the right.

Every line of code still running in production competes for the same budget as the next feature you want to build. Code is a liability you keep paying for as long as it exists, whether it works or not. Teams feel it when they spend more time maintaining what’s already there than building what’s still missing.

As Luis Artola notes in his book Software Economics, Dan North, the creator of behaviour-driven development, draws a clear line between the two: “Code is the cost you incur to get a business capability (which is your asset).” The asset is the capability the code enables, like being able to invoice or serve a customer, so deleting a piece that no longer enables anything cuts cost without removing value.

A bug-free template was already costing almost 650 kB before any real code went in

During the migration of a client’s portal off a legacy system, the repository had started out on top of a generic template. We decided to stop stacking screens on top of it and remove it entirely. That meant deleting 3 pieces:

  1. A sample dashboard that existed only to show how the project was put together, with no business capability depending on it.
  2. Completely fictional customer-portal navigation that didn’t reflect the real portal, and whose structure every migrated screen would have inherited.
  3. An authentication system that mimicked a real gateway without connecting to one, so every new screen would have been built on fake access.

Those 3 pieces had gone months without failing, and they were still costing us. The app shipped as a single bundle of almost 650 kB, right when a lot of real code was about to land, which meant every new screen would inherit the template’s weight and structure.

Timing mattered. With that much code on top, removing the template would have meant untangling every screen that leaned on it. Doing it before the code landed kept the deletion down to 3 isolated pieces.

A single bundle forces anyone opening the app to download the code for every screen just to see one. Deleting the template also pushed us to introduce route-based lazy loading, so the browser only requests the code for the screen being visited. That combination of cleanup and lazy loading is what made the rest possible: every migrated screen now lands on its own foundations, not on a template that was never designed to grow that way.

Even correct code keeps paying 2 of the 4 costs

When someone asks how much software costs, they usually think about building it: the team’s hours, the sprint that delivered it, the consultancy’s invoice. That’s just one of the 4 costs every piece of code carries, and probably not the biggest, because some costs show up before the first line is written and others only kick in once the code has been in production for a while. Mixing them up leads you to estimate only the first one.

In Software Economics, Luis Artola covers the breakdown proposed by Martin Fowler: the cost to build, to repair, of carry (keeping the piece alive release after release) and of delay (what it costs the team to ship the next thing while living alongside it). The mix changes with the scenario: the wrong feature pays build, carry and delay; the right feature built badly pays repair instead of build, plus the other 2; the right feature built well pays only carry and delay. Carry and delay show up in all 3 scenarios, so not even the best code is free from the day it exists.

The 3 template pieces were paying exactly those 2 costs: carry, because they kept shipping with every release of the portal; delay, because every new screen had to live alongside them. The repair cost was 0 because they never failed. Even so, the bill kept arriving.

In the chapter on when and why to invest in code design, Artola recalls that Edsger Dijkstra, computing pioneer and Turing Award winner, suggested counting lines of code as “lines spent”; counting lines as output is counting expenses as if they were revenue. None of these costs shows up as a line on the balance sheet. That’s why understanding where software’s value comes from for a business matters as much as understanding where its cost comes from.

With AI agents, code is a liability that grows for free and costs just the same

The argument has held true for years, and in 2026 it has become urgent: AI assistants and agents have pushed the marginal cost of writing new code close to zero. Generating a function, a screen or a full endpoint now takes a few minutes with the right harness. If generating code is nearly free, the codebase grows for free, but the cost of ownership doesn’t go down, because someone still has to read it, understand it, test it and maintain it with far more volume piled on top than before.

The cost shifts to change, verification and judgment. An agent can suggest a deletion and even prepare it; deciding which business capability each piece enables is still a decision for people.

Michael Feathers, author of Working Effectively with Legacy Code, sums it up in one passage from his essay “To Kill Code”: “Code is inventory. It is stuff lying around and it has substantial cost of ownership. I think that the future belongs to organizations that learn how to strategically delete code.” Rarely used code takes up mental space and maintenance effort, just like a warehouse full of parts nobody orders.

Andy Hunt, co-author of The Pragmatic Programmer, takes it further in a quote Artola cites: “The best refactors are deletions.” Refactoring a piece that no longer adds value is just keeping a better-looking liability; waiting until touching it is so expensive that nobody dares only makes deleting it pricier.

Artola’s book includes a design tip along those lines: write code that’s easy to delete, even if it costs a bit more to extend. These are the signals we use to decide when to delete instead of fix:

  • Nobody on the team can explain why the piece exists without opening the code: it no longer enables a known capability, and every change around it is made blind.
  • It’s gone more than one cycle without anyone touching it except to keep it alive: you’re only paying carry and getting nothing back.
  • Another part of the system covers its function more directly: keeping 2 pieces for the same capability means paying carry twice.

Accountants capitalise code, but the value stays with the team

Saying code is a liability clashes with accounting, and the accounting logic makes sense: if the work is done, it should be worth something. Code is booked as an asset. In Software Economics, Artola puts it this way: “Any accountant will tell you that code is an asset.” Accumulating work sounds, at first, like having something valuable stored away.

The book puts that intuition to the test in 2 ways. It asks you to choose between a team with 10 years of experience on the product but without the code, or the code without the team. It also asks you to explain how companies that publish their code as open source still make money. If code were the asset, giving it away should sink those companies. And yet they keep invoicing.

Both tests point to the same thing: what holds value is the ability to produce, maintain and evolve the code; that ability lives in people and in how they work together. Code is the footprint that ability leaves behind as it’s exercised. Confusing the footprint with whoever left it means treating as an asset what is really the cost of getting here.

Treating code as a liability starts with measuring it. At Orbitant, for example, we record each project’s technical debt in numbered, dated entries: what it is, why it exists, how much it costs to maintain and how it leaves the system.

This article opens a series on software economics. The next one looks at why an organisation ends up optimising the only variable it can measure, cost, while value, risk and debt stay out of the conversation. If you can’t name the business capability a piece of code enables, treat it as a liability with nothing on the other side of the ledger and put it on the deletion list for the next cycle.

Follow our journey building AI agents from the inside

    Newsletter language: