Long method smell
From CSSEMediaWiki
(Difference between revisions)
Line 3: | Line 3: | ||
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 the [http://www.refactoring.com/catalog/extractMethod.html 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 the [http://www.refactoring.com/catalog/extractMethod.html 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. | + | 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. [http://sis36.berkeley.edu/projects/streek/agile/bad-smells-in-code.html#Long+Method] |
Revision as of 05:01, 29 July 2008
"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." --Bad Smells
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 the 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. [1]