Deleting Code Is the Job
The best pull request I shipped this quarter had a negative line count.
The change I'm most pleased with this quarter removed about four hundred lines and added eleven.
It fixed nothing. No bug, no feature. It took out a layer that had stopped being necessary about a year earlier and that everybody had been routing around since.
Why this is hard to do
Every incentive is against it.
You can't demo a deletion. "I removed the thing" doesn't screenshot. There's no user-visible improvement to point at, and if you've done it well, nothing happens at all — the best possible outcome is that nobody notices.
It's also risky in a way that building isn't. New code that's wrong breaks the new thing. Deleted code that was load-bearing breaks something nobody remembered depended on it.
So the payoff is invisible and the downside is visible. Of course people build instead.
What it's worth
The thing nobody counts: every line of code is read far more often than it was written.
That dead layer wasn't costing CPU. It was costing attention. Every person tracing a request through that path had to understand it, decide it was irrelevant, and route around it. Call it fifteen minutes each, times everyone who's touched that flow in a year.
That's the real bill. It's enormous, and it appears in no dashboard, which is precisely why it never gets paid down.
How to do it without being reckless
The approach I've settled on:
- Prove it's dead, don't assume. Search the whole organisation, not one repo. Check history for why it was added — the commit message often tells you what it was for and whether that's still true.
- Make it loud before making it gone. Log on entry and ship that first. A week of silence is evidence; your reading of the code is a hypothesis.
- Delete in one commit, alone. Not bundled with a feature. A revert should be one command, and a reviewer should be able to see the whole shape at once.
- Say what you checked in the description. This is what gets it approved. "I removed this" invites worry; "I removed this, here's every call site I searched and the week of logs showing zero hits" invites a merge.
The line I'd keep
A codebase is not the sum of what it does. It's the sum of what someone has to understand to change it safely.
Deleting reduces the second number without touching the first, and that is unambiguously good work, even though nobody will thank you for it.