Dev Genius

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

Follow publication

Code Smell 45 — Not Polymorphic

Maximiliano Contieri
Dev Genius
Published in
1 min readDec 7, 2020

Problems

  • Missed Polymorphism
  • Coupling
  • IFs / Type check Polluting
  • Names coupled to types.
  • Favor polymorphism.

Solutions

  1. Rename methods after what they do.

Sample Code

Wrong

Right

Detection

This is a semantic mistake. We could add a warning for similar method names on Polymorphic classes.

Tags

  • Polymorphic

Conclusion

Naming is very important. We need to name after concepts and not after accidental types,

Relations

More info

If you have three pet dogs, give them names. If you have 10,000 head of cattle, don’t bother. Nowadays, the idea of giving a name to every file on your computer is ridiculous.

David Gelernter

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