Code Smell Object-Design Intruders

Lecture



All these smells are an incomplete or incorrect use of object-oriented programming features.

Switch statements

You have a complex switch statement or a sequence of ifs.

Temporary field

Temporary fields are fields that the object needs only under certain circumstances. Only then they are filled with some values, remaining empty the rest of the time.

Waiver of inheritance

If the subclass uses only a small fraction of the inherited methods and properties of the superclass, this is a sign of the wrong hierarchy. In this case, unnecessary methods can simply not be used or be redefined and throw exceptions.

Alternative classes with different interfaces

Two classes perform the same function, but have different method names.

created: 2019-01-25
updated: 2021-03-13
132265



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Refactoring theory

Terms: Refactoring theory