Data clumps smell

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Ebybymic (Talk); changed back to last version by Filip Kujikis)
 
Line 1: Line 1:
----
+
Data clumps are groups of data items that are related and are always used or passed around together. They are often primitive values. An example of this is a "start" variable and an "end" variable.
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
+
----
+
=[http://olitudyxej.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
+
----
+
=[http://olitudyxej.co.cc CLICK HERE]=
+
----
+
</div>
+
Data clumps are groups of data items that are related and are always used or passed around together. They are often primitive values. An example of this is a &quot;start&quot; variable and an &quot;end&quot; variable.
+
  
Martin Fowler suggests replacing these clumps with a single object. In the example above the start and end could be replaced by a &quot;Range&quot; class. Doing this refactoring decreases the size of parameter lists when the values are passed around. This is one solution to the [[Long parameter list smell]]. You can also discover some nice behaviour when you extract the data into an object. For the Range example, you often want to know if a value is within the start and end range, so you could define an &quot;includes&quot; method in the Range class to check for this easily.
+
Martin Fowler suggests replacing these clumps with a single object. In the example above the start and end could be replaced by a "Range" class. Doing this refactoring decreases the size of parameter lists when the values are passed around. This is one solution to the [[Long parameter list smell]]. You can also discover some nice behaviour when you extract the data into an object. For the Range example, you often want to know if a value is within the start and end range, so you could define an "includes" method in the Range class to check for this easily.
  
 
== Common Refactorings ==
 
== Common Refactorings ==

Latest revision as of 03:21, 25 November 2010

Data clumps are groups of data items that are related and are always used or passed around together. They are often primitive values. An example of this is a "start" variable and an "end" variable.

Martin Fowler suggests replacing these clumps with a single object. In the example above the start and end could be replaced by a "Range" class. Doing this refactoring decreases the size of parameter lists when the values are passed around. This is one solution to the Long parameter list smell. You can also discover some nice behaviour when you extract the data into an object. For the Range example, you often want to know if a value is within the start and end range, so you could define an "includes" method in the Range class to check for this easily.

Common Refactorings

See also



Personal tools