Back to Catalog
Code Smells
Bloaters
Data Clumps
Groups of variables that always appear together should be extracted into objects.
Intent & Description
'
🎯 Intent
Identify variables that always appear together in method signatures and function calls.
📋 Context
You see the same group of parameters being passed around together (e.g., x, y, z coordinates or start date, end date).
💡 Solution
Extract these clumps into their own class or object.'
Real-world Use Case
Use when the same group of variables appears together in multiple places.
Source
📌 TL;DR
Variables that always appear together should be objects. Improves code organization and reduces parameter counts.