Engineering · 24 Nov 2026
We deleted a third of the code and shipped a better product
Where deletable code hides, how to find it with evidence instead of opinion, and why a smaller codebase has fewer bugs, faster tests and quicker onboarding.
Emin C. Homalioglu · 4 min read

After three years of shipping one of our own products, we measured which parts of it actually ran. A third of the code had not executed once in ninety days. We deleted it, and the next release was the most stable one the product had had.
The short version
If your company owns software that has been in use for a few years, ask whoever maintains it:
- How many feature flags exist, and how many of them have the same value for every customer?
- Which endpoints, screens and database columns had no use in the last ninety days?
- When was code last deleted on purpose, and who decides that?
If nobody can answer the first question with a number, part of what you pay for in maintenance is code nobody uses.
Where deletable code hides
It collects in predictable places:
- Settings with one value in production. A flag that is on for every customer is a branch you test in both directions and ship in one.
- Feature flags that outlived their rollout. The feature went live for everyone months ago. The flag, its other branch and its row in the test matrix are still there, evaluated on every request.
- Abstractions for a second caller that never came. An interface with one implementation. A generic importer that only ever imports one format. A plugin system without plugins.
- Defensive code for impossible inputs. Null checks on a column that cannot be null. A fallback case for a value the type system already forbids.
- Dead endpoints and dead columns. A legacy route with no traffic in ninety days. A column kept "just in case" after the migration that replaced it.
- Temporary shims that became permanent. A translation layer from a data migration that finished long ago and still runs on every read.
How we found it
We instrumented instead of arguing. For ninety days the product logged every flag read, every endpoint call and every branch of the larger conditionals. What never fired went on a list, with the evidence attached. For abstractions we counted real implementations: fewer than two, and the interface was inlined and removed.
The list came out at a third of the codebase. Fourteen of twenty-three flags had one value everywhere. Two whole modules served a customer segment that had never signed up. The cleanup took three weeks and needed no meeting, because every line on the list came with its own proof.
What changed afterwards
The effects were concrete:
- Fewer reachable states. The same test suite now covered a larger share of a smaller system. Its runtime fell from eleven to six minutes.
- Faster onboarding. A new developer built a correct picture of the system sooner, because there was less to picture and less of it was misleading.
- Whole classes of bugs gone. A bug living in the interaction of two flags cannot exist once one of them is deleted. We did not fix those bugs. We removed the ground they grew in.
Dead code is also a risk on its own. In 2012 the trading firm Knight Capital reused an old flag for a new feature. On one of eight servers the new code had not been deployed, and the flag switched on a retired function that was still there. In about 45 minutes the firm lost 440 million dollars (Knight Capital, Wikipedia). Code that is gone cannot be switched back on by accident.
The discipline that keeps it deleted
Two rules do most of the work. First, no abstraction before the third real caller exists, since the first two teach you the wrong shape; Martin Fowler's argument against building for imagined needs makes the same case (Fowler, YAGNI). Second, delete on a schedule instead of by permission. Every flag, branch and shim has to justify itself once a quarter and is removed by default when nobody speaks up for it.
The objection is always "we might need it again". Version control keeps every deleted line one revert away. Until it is needed, it stays out of the code everyone has to read past, test around and keep compiling.
Every line that stays costs attention from everyone who builds next to it, whether it runs or not.
24 Nov 2026 · Emin C. Homalioglu


