Last Revision — April 19, 2022
1 Min Read
Blob Brain Class Complex Class God Class God Object Schizophrenic Class Ice Berg Class
Bloaters
Measured Smells
Within a Class
- Dubious Abstraction (co-exist)
- Long Method (caused)
- Long Parameter List (caused)
- Temporary Field (caused)
Martin Fowler in book (1999): "Refactoring: Improving the Design of Existing Code"
When one combines the smell of Long Method and Long Parameter List, but on a higher abstraction level, then he would get the Large Class code smell. Many long-form methods and an abundant number of parameters that can be passed to a class cause Large Class problems. The point is that the class has too many responsibilities and is doing too much.
This problem occurs because, under time constraints, it is much easier to place a new code in an existing class than to create a whole new class for the feature.
Large components are hard to comprehend, which amplifies if the element is not purely functional and stateless.
It is tough to assess where the change has to be made, and even after it is done, the developer has to verify whether that was the only one in the class that had to be changed to implement his new desired functionality. There is also the risk of breaking the functionalities of all the other responsibilities that the class has and breaking by making unexpected side effects.
The larger the class, the more potential scenarios (all the methods and state variations) have to be covered via tests.