---
title: "Data Clumps"
type: "code-smell"
slug: "data-clumps"
url: "http://localhost:3000/en/smells/data-clumps.md"
category: "Bloaters"
description: "Sometimes different parts of the code contain identical groups of variables (such as parameters for connecting to a database). These clumps should be turned into their own classes."
---
# Data Clumps

> Sometimes different parts of the code contain identical groups of variables (such as parameters for connecting to a database). These clumps should be turned into their own classes.

## Signs and Symptoms

Sometimes different parts of the code contain identical groups of variables (such as parameters for connecting to a database). These clumps should be turned into their own classes.

## Reasons for the Problem

Often these data groups are due to poor program structure or "copypasta programming”.

If you want to make sure whether or not some data is a data clump, just delete one of the data values and see whether the other values still make sense. If this isn’t the case, this is a good sign that this group of variables should be combined into an object.

## Payoff

* Improves understanding and organization of code. Operations on particular data are now gathered in a single place, instead of haphazardly throughout the code.
* Reduces code size.
## Relations

**Treated by**

- [Extract Class](/en/extract-class.md)
- [Introduce Parameter Object](/en/introduce-parameter-object.md)
- [Preserve Whole Object](/en/preserve-whole-object.md)


## Detected by

- **sonar** `S107` — Functions should not have too many parameters (https://rules.sonarsource.com/java/rspec-107/)
- **pmd** `ExcessiveParameterList` — Excessive Parameter List (https://docs.pmd-code.org/latest/pmd_rules_java_design.html#excessiveparameterlist)
- **eslint** `max-params` — Enforce a maximum number of parameters (https://eslint.org/docs/latest/rules/max-params)
