Data class smell

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 3: Line 3:
 
== Validity ==
 
== Validity ==
  
What exactly is wrong with data classes? Data classes always seemed useful and necessary to me - for example, geometric constructs such as points and vectors. Data classes can definitely be misused, but I don't think this smell should be considered an automatic refactoring job.
+
What exactly is wrong with data classes? Data classes always seemed useful and necessary to me - for example, geometric constructs such as points and vectors (Have you tried types ? Are you using the right language ?). Data classes can definitely be misused, but I don't think this smell should be considered an automatic refactoring job.
  
 
== Refactoring techniques ==
 
== Refactoring techniques ==

Revision as of 12:44, 29 September 2010

The data class smell is present where a class has only fields, getters, setters and nothing else. It lacks the behaviours that make it a proper, stand-alone class (and consequently, the instantiated object).

Validity

What exactly is wrong with data classes? Data classes always seemed useful and necessary to me - for example, geometric constructs such as points and vectors (Have you tried types ? Are you using the right language ?). Data classes can definitely be misused, but I don't think this smell should be considered an automatic refactoring job.

Refactoring techniques

See also


Personal tools