Long method smell

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m (See also)
Line 1: Line 1:
"Object programs live best and longest with short methods. The payoffs of indirection - explanation, sharing and choosing - are supported by little methods. Everybody knows short is good." [http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Long+Method (1)]
+
----
 +
<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://ycybesav.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://ycybesav.co.cc CLICK HERE]=
 +
----
 +
</div>
 +
&quot;Object programs live best and longest with short methods. The payoffs of indirection - explanation, sharing and choosing - are supported by little methods. Everybody knows short is good.&quot; [http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Long+Method (1)]
  
 
The Long method code smell is a sign that you possibly need to take some part of related functionality in your method and create a new method to hold this functionality. This action is known as [[Extract Method]]  
 
The Long method code smell is a sign that you possibly need to take some part of related functionality in your method and create a new method to hold this functionality. This action is known as [[Extract Method]]  
Line 7: Line 15:
 
== References ==
 
== References ==
  
1. [http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Long+Method Bad Smells in Code - A Summary of Martin Fowler's Code Smell Chapter in "Refactoring"]
+
1. [http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Long+Method Bad Smells in Code - A Summary of Martin Fowler's Code Smell Chapter in &quot;Refactoring&quot;]
 
==External Links==
 
==External Links==
 
[http://www.refactoring.com/catalog/extractMethod.html Extract Method]
 
[http://www.refactoring.com/catalog/extractMethod.html Extract Method]

Revision as of 05:22, 24 November 2010


"Object programs live best and longest with short methods. The payoffs of indirection - explanation, sharing and choosing - are supported by little methods. Everybody knows short is good." (1)

The Long method code smell is a sign that you possibly need to take some part of related functionality in your method and create a new method to hold this functionality. This action is known as Extract Method

Comments in your method are sometimes a good sign that you need to extract the block of code that has been commented into a new method whose name describes the functionality that the comment was originally describing. Even if a single line of code requires explanation then it is probably worth extracting it into a new method. (1)

References

1. Bad Smells in Code - A Summary of Martin Fowler's Code Smell Chapter in "Refactoring"

External Links

Extract Method

See also


Personal tools