The Beauty of Deleting Code - Why Less Is Almost Always Better
The Beauty of Deleting Code - Why Less Is Almost Always Better
The best days in engineering are the ones where you delete more lines than you write. There is something deeply satisfying about replacing a 600-line custom parser with 40 lines using the standard library. Not because shorter code is inherently better, but because it usually means you found the right abstraction.
Why We Over-Engineer
Most unnecessary code exists because someone solved a problem before fully understanding it. You start writing a parser, hit edge cases, add special handling, layer on more conditions, and end up with 600 lines that are fragile, hard to test, and difficult for anyone else to understand.
The standard library already handles those edge cases. It has been tested by millions of users across thousands of use cases. Your 600-line custom solution is competing against decades of battle-tested code.
The Cost of Code That Exists
Every line of code is a liability. It needs to be maintained, reviewed, tested, and understood by future developers. When you delete code, you reduce all of these costs simultaneously. The codebase becomes easier to navigate, builds run faster, and there are fewer places for bugs to hide.
This is especially relevant in the age of AI-assisted coding. When AI can generate hundreds of lines in seconds, the bottleneck shifts from writing code to deciding what code should exist. The discipline of deletion becomes more important, not less.
How to Develop the Deletion Habit
Start by questioning every abstraction. If a wrapper class just delegates to another class, delete it. If a utility function is used in one place, inline it. If a configuration system is more complex than the thing it configures, simplify it.
Review old code with fresh eyes. Code you wrote six months ago often has assumptions that are no longer true. Features that seemed necessary turned out to be unused. Optimizations that made sense at one scale are irrelevant at another.
The AI Agent Angle
When building AI agents, simplicity is even more critical. Every additional component is another potential failure point. Every unnecessary layer of abstraction is another thing the LLM needs to understand and navigate correctly. The simplest agent that reliably accomplishes the task will always outperform the clever one.
Fazm is an open source macOS AI agent. Open source on GitHub.