Premature Abstraction
ELI5 — The Vibe Check
Premature abstraction is creating a reusable, generic solution before you have enough examples to know what the abstraction should look like. You write a BaseAnimalFactory<T> when all you need is a Dog class. Three months later, the abstraction doesn't fit any real use case and everyone works around it. The opposite of DRY isn't WET — it's wrong.
Real Talk
Premature abstraction occurs when developers create abstractions (interfaces, base classes, generic utilities) before understanding the actual variation in requirements. Unlike premature optimization, which wastes performance effort, premature abstraction creates rigid structures that constrain future development. The Rule of Three suggests waiting for three concrete examples before abstracting.
When You'll Hear This
"We premature-abstracted the payment system and now none of the providers fit the interface." / "Duplicate code is better than the wrong abstraction."
Related Terms
Abstraction
Abstraction is hiding the messy details and showing only what matters.
DRY (Don't Repeat Yourself)
If you find yourself copy-pasting the same code in multiple places, STOP. Make it a reusable function instead.
Premature Optimization
Premature Optimization is Knuth's famous warning: 'Premature optimization is the root of all evil.
Refactor
Refactoring is cleaning and reorganizing your code without changing what it does — like tidying your room without throwing anything away.
YAGNI (You Aren't Gonna Need It)
Don't build stuff you don't need right now.