Code Smell 45 — Not Polymorphic
- Missed Polymorphism
- IFs / Type check Polluting
- Names coupled to types.
- Favor polymorphism.
- Rename methods after what they do.
This is a semantic mistake. We could add a warning for similar method names on Polymorphic classes.
Naming is very important. We need to name after concepts and not after accidental types,
Code Smell 36 — Switch/case/elseif/else/if statements
First programming lesson: Control structures. Senior developer lesson: avoid them.
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.
This article is part of the CodeSmell Series.