Back to Catalog
Code Smells
Dispensables
Speculative Generality
Code designed for future needs that never materialize.
Intent & Description
'
π― Intent
Identify unnecessary abstraction or flexibility added for hypothetical future requirements.
π Context
You have abstract classes, interfaces, or methods designed for future use that never happened. This adds complexity without value.
π‘ Solution
Remove unnecessary abstractions. Apply YAGNI principle - build what you need now.'
Real-world Use Case
Use when code includes unused abstractions designed for “future needs.”
Source
π TL;DR
Don’t build for hypothetical futures. Remove unused abstractions and follow YAGNI.