← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · updated 7d
← Back to glossary

Data Clump

Code Quality Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). While phpmd and phpstan are listed as detection tools, automated detection is marked as 'no' — these tools can flag long parameter lists but cannot automatically determine whether parameters form a conceptual group that warrants extraction. Identifying true data clumps requires human judgment during code review to recognize that the same 3+ fields travel together across multiple signatures.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix shows a single signature change, but data clumps by definition appear in 'multiple function signatures' per the code_pattern. Extracting an Address or Location class requires creating the new class, updating all call sites passing those parameters, and modifying all receiving functions — a coordinated refactor across multiple files but typically within one domain area.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Data clumps create ongoing friction: the detection_hints note they 'drift out of sync' across signatures, parameters must be threaded through multiple layers, and changes to the group require updates everywhere. The missing abstraction imposes a tax on many work streams (any feature touching those parameters), but doesn't define the system's architecture — it's a localized structural problem that compounds over time.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap' (t5). The misconception explicitly states developers believe 'Passing multiple related parameters is just a style issue.' This is a documented gotcha that most developers eventually learn — they don't initially recognize that data clumps signal missing domain concepts and often reveal behaviour that should move to the extracted class. The trap is cognitive: the pattern looks harmless until you understand OOP abstraction principles.

About DEBT scoring →

Also Known As

data clumps parameter clump repeated field group

TL;DR

The same group of variables appearing together repeatedly — a signal they belong in a class together.

Explanation

A data clump is a group of variables that always appear together — passed as a parameter list, stored as parallel arrays, or initialised together. If you see $firstName, $lastName, $email passed as three separate parameters in multiple functions, they form a data clump. The refactoring is to introduce a class (User, Contact) that holds them together. Data clumps and Long Parameter Lists are closely related — fixing one often fixes the other.

Common Misconception

Passing multiple related parameters is just a style issue. Data clumps signal a missing abstraction — if three fields always travel together, they belong in a class. Creating that class often reveals behaviour that should move there too.

Why It Matters

Data clumps are groups of variables that always appear together — they signal a missing abstraction; extracting them into a class gives the group a name, behaviour, and a single place to validate.

Common Mistakes

  • Passing latitude, longitude, and zoom as separate parameters to every mapping function instead of a Location object.
  • Using parallel arrays (names[], emails[]) instead of an array of objects.
  • Defining the same group of parameters in multiple function signatures — they drift out of sync.
  • Not adding behaviour to the extracted class — a plain data holder is better than a clump but a value object with validation is better still.

Code Examples

✗ Vulnerable
// Same group of primitives repeated across multiple functions
function createUser(string $street, string $city, string $postcode) {}
function updateAddr(int $id, string $street, string $city, string $postcode) {}
function validateAddr(string $street, string $city, string $postcode): bool {}
✓ Fixed
// Extract into a value object
readonly class Address {
    public function __construct(
        public string $street,
        public string $city,
        public string $postcode,
    ) {}
}

function createUser(Address $address) {}
function updateAddr(int $id, Address $address) {}
function validateAddr(Address $address): bool {}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 87
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings F 1 ping S 0 pings S 2 pings M 0 pings T 1 ping W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 2 pings M 2 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 1 ping T 0 pings W 0 pings T 1 ping F 0 pings S
No pings yet today
Amazonbot 1
Ahrefs 9 Google 8 Amazonbot 8 SEMrush 5 ChatGPT 5 Scrapy 5 Perplexity 4 PetalBot 4 Unknown AI 3 Bing 3 Applebot 2 Twitter/X 1
crawler 52 crawler_json 4 pre-tracking 1
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
When 3+ parameters always appear together, extract them into a named object — function ship(string $street, string $city, string $country, string $zip) becomes ship(Address $address)
📦 Applies To
any web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
Same group of 3+ parameters in multiple function signatures; address components passed separately; coordinates as separate lat/lng parameters everywhere
Auto-detectable: ✗ No phpmd phpstan
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: Medium Context: Class Tests: Update


✓ schema.org compliant