Abstraction is one of the most powerful tools in software engineering.
It allows us to manage complexity by hiding details.
But abstraction is not free.
The cognitive cost
Every abstraction introduces a new concept.
Developers must learn:
- what the abstraction represents
- how it behaves
- when it should be used
Too many abstractions can make systems harder to understand.
The illusion of simplicity
Abstractions often make code look shorter.
But shorter code is not always simpler code.
Sometimes the logic simply moves elsewhere.
When abstraction helps
Abstraction is useful when it captures a stable concept.
For example:
- a database client
- a logging layer
- a reusable UI component
These represent ideas that are unlikely to change dramatically.
A practical rule
Before introducing an abstraction, ask:
"Is this pattern stable enough to deserve its own concept?"
If the answer is unclear, it may be better to wait.