15
Speculative Generality
Symptom
Hooks, abstract base classes, configuration knobs, and parameters added 'in case we need them' — but no real call site uses them.
Goal
The code expresses exactly what it does today — abstraction earns its keep when a real second user shows up.
Smellier version
class Strategy { execute() {} }
class OnlyStrategy extends Strategy { execute() { /* the real one */ } }
new OnlyStrategy().execute();Fresher versionfunction execute() {
// the real one
}
execute();Savings
Smaller surface, fewer concepts, fewer test branches.
Note
Tests are forced to cover branches no one exercises; readers learn a vocabulary they don't need; YAGNI debt compounds.