Code Smell 95 — Premature Classification
We are over generalizers. We shouldn’t create abstractions until we see enough concretions.

TL;DR: Don’t guess what the future will bring you.
Context
Aristotelian Classification is a big problem in computer science.
We tend to classify and name things before gathering enough knowledge and context.
Problems
- Futurology
- Bad designs
Solutions
- Wait for concretions
- Refactor late
Sample Code
Wrong
Right
Detection
An abstract class with just one subclass is an indicator of premature classification
Tags
- Bad Design
- Classification
Conclusion
When working with classes, we name abstractions as soon as they appear.
Our rule is to choose good names after the behaviour.
We should not name our abstractions until we name our concrete subclasses.
Relations
More Info
Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.
Donald E. Knuth
This article is part of the CodeSmell Series.