Back to Catalog
Code Smells
Dispensables
Data Class
Classes that only contain data and no behavior.
Intent & Description
'
🎯 Intent
Identify classes that are essentially data containers with no meaningful behavior.
📋 Context
You have classes that only contain fields and getters/setters, with no business logic or behavior.
💡 Solution
Move behavior from client classes into the data class, or eliminate the data class if it’s not adding value.'
Real-world Use Case
Use when classes are pure data containers with no behavior.
Source
📌 TL;DR
Classes with only data and no behavior should either have behavior added or be simplified to structures.