Large class smell

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m (See also)
Line 1: Line 1:
"A class with too much code is prime breeding ground for duplicated code, chaos, and death." - ''Refactoring'' [[Martin Fowler 1999]]
+
----
 +
<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://ynejynezex.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
 +
----
 +
=[http://ynejynezex.co.cc CLICK HERE]=
 +
----
 +
</div>
 +
&quot;A class with too much code is prime breeding ground for duplicated code, chaos, and death.&quot; - ''Refactoring'' [[Martin Fowler 1999]]
  
 
''Refactoring'' [[Martin Fowler 1999]] states that: When a class is trying to do too much, it often shows up as too many instance variables. When a class has too many instance variables, duplicated code cannot be far behind.
 
''Refactoring'' [[Martin Fowler 1999]] states that: When a class is trying to do too much, it often shows up as too many instance variables. When a class has too many instance variables, duplicated code cannot be far behind.
Line 5: Line 13:
 
== Refactoring ==
 
== Refactoring ==
  
''Refactoring'' gives some suggestions on how the Large class code smell can be remedied. You can use the [[Extract Class]] technique to group related variables into a new class. ''Refactoring'' recommends to: Choose variables to go together in the component (class) that makes sense for each. For example, "depositAmount" and "depositCurrency" are likely to belong together in a component (class). If a group of instance variables share common prefixes of suffixes in the class then this may suggest that creating a seperate class for those variables is a good idea.
+
''Refactoring'' gives some suggestions on how the Large class code smell can be remedied. You can use the [[Extract Class]] technique to group related variables into a new class. ''Refactoring'' recommends to: Choose variables to go together in the component (class) that makes sense for each. For example, &quot;depositAmount&quot; and &quot;depositCurrency&quot; are likely to belong together in a component (class). If a group of instance variables share common prefixes of suffixes in the class then this may suggest that creating a seperate class for those variables is a good idea.
  
 
== See also ==
 
== See also ==

Revision as of 05:23, 24 November 2010


"A class with too much code is prime breeding ground for duplicated code, chaos, and death." - Refactoring Martin Fowler 1999

Refactoring Martin Fowler 1999 states that: When a class is trying to do too much, it often shows up as too many instance variables. When a class has too many instance variables, duplicated code cannot be far behind.

Refactoring

Refactoring gives some suggestions on how the Large class code smell can be remedied. You can use the Extract Class technique to group related variables into a new class. Refactoring recommends to: Choose variables to go together in the component (class) that makes sense for each. For example, "depositAmount" and "depositCurrency" are likely to belong together in a component (class). If a group of instance variables share common prefixes of suffixes in the class then this may suggest that creating a seperate class for those variables is a good idea.

See also


Personal tools