Code Smell 34 - Too Many Attributes

Code Smell 34 - Too Many Attributes

Maxi Contieri
·Nov 25, 2020·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

A class defines objects with lots of attributes.


  • Low Cohesion

  • Coupling

  • Maintainability

  • Readability


  1. Find methods related to attributes.
  2. Cluster these methods.
  3. Break the object related to those clusters.
  4. Find real objects related to this new objects and replace existing references.


  • DTOs

  • Denormalized table rows

Sample Code



Most linters warn when you declare too many attributes. Setting a good warning threshold should be easy.


  • Primitive


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.



Photo by Andy Li on Unsplash

So much complexity in software comes from trying to make one thing do two things.

Ryan Singer

This article is part of the CodeSmell Series.

Share this


Technical Opinions are my own. I don't have the revealed truth.

Software Design is a creative activity. These are hints and not rigid rules.

I write on BackEnd Business Systems and OOP Design. My advice/experience might not suit other systems.