Code Smell 34 — Too Many Attributes
- Low Cohesion
- Find methods related to attributes.
- Cluster these methods.
- Break the object related to those clusters.
- Find real objects related to this new objects and replace existing references.
- Denormalized table rows
Most linters warn when you declare too many attributes. Setting a good warning threshold should be easy.
Bloated objects know too much and are very difficult to change due to cohesion.
Developers change these objects a lot, so they bring merge conflicts and are a common problems source.
So much complexity in software comes from trying to make one thing do two things.
This article is part of the CodeSmell Series.