Comments smell

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: This smell does not say that you shouldn't use comments. However, it does say that developers should be wary of code that is heavily commented. If you need to add a lot of comments to your...)
 
m (Common Refactorings added)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This smell does not say that you shouldn't use comments. However, it does say that developers should be wary of code that is heavily commented. If you need to add a lot of comments to your code to explain it, this indicates that the code is too complicated and should be simplified.  
 
This smell does not say that you shouldn't use comments. However, it does say that developers should be wary of code that is heavily commented. If you need to add a lot of comments to your code to explain it, this indicates that the code is too complicated and should be simplified.  
  
In [[Martin Fowler 1999]], Fowler says "When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous."
+
In [[Martin Fowler 1999]], Fowler says "When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous". This often means using [[Extract Method]] and [[Introduce Assertion]].
 +
 
 +
== See also ==
 +
* [[Code smells]]
 +
 
 +
{{Template:CodeSmells}}
 +
 
 +
[[Category:Code smells]]

Latest revision as of 23:22, 14 October 2009

This smell does not say that you shouldn't use comments. However, it does say that developers should be wary of code that is heavily commented. If you need to add a lot of comments to your code to explain it, this indicates that the code is too complicated and should be simplified.

In Martin Fowler 1999, Fowler says "When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous". This often means using Extract Method and Introduce Assertion.

See also


Personal tools