Data clump
In object-oriented programming, a data clump is any group of variables which are passed around together (in a clump) throughout various parts of the program. A data clump, like other code smells, can indicate deeper problems with the program design or implementation. The group of variables that typically make up a data clump are often closely related or interdependent and are often used together in a group as a result. A data clump is also known as a specific kind of class-level code smell that may be a symptom of poorly written source code.
In object-oriented programming, a data clump is any group of variables which are passed around together (in a clump) throughout various parts of the program. A data clump, like other code smells, can indicate deeper problems with the program design or implementation. The group of variables that typically make up a data clump are often closely related or interdependent and are often used together in a group as a result. A data clump is also known as a specific kind of class-level code smell that may be a symptom of poorly written source code. public void AddCoords(int x, int y, int z) { // ... } Post refactor: public void AddCoords(Coords coords) { // ... } public class Coords { public Coords(int x, int y, int z) { this.X = x; this.Y = y; this.Z = z; } public int X { get; } public int Y { get; } public int Z { get; } } package org.wikipedia.examples; public class Example { public static void welcomeNew(String firstName, String lastName, int age, String gender, String occupation, String city) { System.out.printf("Welcome %s %s, a %d-year-old %s from %s who works as a %s.%n", firstName, lastName, age, gender, city, occupation); } public static void main(String args[]) { String firstName = args[0]; String lastName = args[1]; int age = Integer.parseInt(args[2]); String gender = args[3]; String occupation = args[4]; String city = args[5]; welcomeNew(firstName, lastName, age, gender, occupation, city); } } In the previous example, all of the variables could be encapsulated into a single " Person " object, which could be passed around by itself. Additionally, the programmer may then recognize that the welcomeNew method would be better associated with the Person class, and could then come up with other relevant actions associated with the Person . For instance, the code could be refactored and expanded as follows: package org.wikipedia.examples; public class Example { public record Person(String firstName, String lastName, int age, String gender, String occupation, String city) { // Custom methods can be added to records, so let's include the welcomeNew() and work() methods. public void welcomeNew() { System.out.printf("Welcome %s %s, a %d-year-old %s from %s who works as a %s.%n", firstName, lastName, age, gender, city, occupation); } public void work() { System.out.printf("This is %s working hard on %s in %s%n", firstName, occupation, city); } } public static void main(String args[]) { String firstName = args[0]; String lastName = args[1]; int age = Integer.parseInt(args[2]); String gender = args[3]; String occupation = args[4]; String city = args[5]; Person joe = new Person(firstName, lastName, age, gender, occupation, city); joe.welcomeNew(); joe.work(); } } Although this has increased the length of the code, now the single Person can easily be passed around as one object, rather than as a variety of (seemingly unrelated) fields. Additionally, this gives the opportunity to move associated methods into the class so that they can easily operate upon individual instances thereof. These methods no longer require passing around a tedious list of parameters, as they are instead stored as instance variables upon the object instances themselves.
References
No reference rows published for this article.
Cite this article
MLA
"Data clump." encyclopegia.org, 2026, https://encyclopegia.org/wiki/data-clump. Accessed 24 November 2026.
Chicago
"Data clump." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/data-clump.
APA
encyclopegia.org. (2026). Data clump. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/data-clump
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON