Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

Code Smell 95 — Premature Classification

Maximiliano Contieri
Dev Genius
Published in
2 min readOct 16, 2021

Photo by Faye Cornish on Unsplash

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

  1. Wait for concretions
  2. 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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Maximiliano Contieri

I’m a senior software engineer specialized in declarative designs. S.O.L.I.D. and agile methodologies fan. Maximilianocontieri.com

No responses yet

Write a response