SOLID & Design Patterns Interview Question #130
What is Premature Abstraction?
Anti-Patterns, Refactoring, DI Lifetimes & Senior Design Scenarios Senior Advanced
Quick Interview Answer
Premature Abstraction occurs when developers create generalized interfaces, frameworks, or extension points before they understand the variations the software actually needs. The abstraction can become harder to change than duplicated straightforward code.
Detailed Explanation
Premature Abstraction occurs when developers create generalized interfaces, frameworks, or extension points before they understand the variations the software actually needs. The abstraction can become harder to change than duplicated straightforward code.
A useful abstraction should represent a stable concept or demonstrated variation. Waiting for enough evidence often produces a smaller and more accurate design.
Code Example
// Avoid inventing many extension points
// for one known implementation.
// Start concrete, then extract a stable
// abstraction when real variation appears.