Subtraction: the fix that removes
Why it matters Ask for a fix and you get an addition: a cache, a retry, a new check, a helper class. Additions are easy to propose and easy to review one at a time. The system that results is not.
When something is slow, fragile or too big, there are two kinds of fix. You can add a part that compensates, or you can remove the part that causes it. Removal is the one people and AI assistants reach for less, because the question "what should I add?" has an answer you can type, and "what can go?" means reading the whole thing first.
Three things you can delete
A step: an intermediate stage that exists because the first draft needed it. "Load everything, then sort, then group" often only needs "group".
A requirement: a rule that is already guaranteed by another rule. The code that enforces it costs memory, time and reading, and protects nothing.
A component: something built to provide a property the data already has. An index over data that is already in order. A lookup table for ids that are already positions.
How to look
- For each stage, ask what the next stage would lose if this one vanished.
- For each rule, ask whether another rule already makes it true.
- For each structure you build, ask what property it gives you, and whether the input has it already.
Subtraction is not always safe. A rule can look redundant and protect a case nobody wrote a test for. Before deleting, say in one sentence why the thing you remove can never matter. If you cannot, keep it.
Recap Before adding a part, look for a step, a requirement or a component to remove. Delete only what you can prove is not needed.
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.