<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Comments are evil?</title>
	<atom:link href="http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/</link>
	<description></description>
	<lastBuildDate>Thu, 04 Mar 2010 11:11:07 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tseliso</title>
		<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/comment-page-1/#comment-739</link>
		<dc:creator>Tseliso</dc:creator>
		<pubDate>Fri, 07 Aug 2009 06:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://makinggoodsoftware.com/?p=436#comment-739</guid>
		<description>The biggest overhead of repeating &quot;code&quot; is when you have to repeat the effort of maintaining the code and the repeat of the code, in this case comments.  

Having code with less repeats -the same principle behind generic usable code- avoids this overhead and avoids having situations where the duplication goes out of synch.

Imagine how confusing comments that are out synch with the actual code can be.</description>
		<content:encoded><![CDATA[<p>The biggest overhead of repeating &#8220;code&#8221; is when you have to repeat the effort of maintaining the code and the repeat of the code, in this case comments.  </p>
<p>Having code with less repeats -the same principle behind generic usable code- avoids this overhead and avoids having situations where the duplication goes out of synch.</p>
<p>Imagine how confusing comments that are out synch with the actual code can be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Svend Tofte</title>
		<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/comment-page-1/#comment-191</link>
		<dc:creator>Svend Tofte</dc:creator>
		<pubDate>Wed, 08 Jul 2009 19:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://makinggoodsoftware.com/?p=436#comment-191</guid>
		<description>People seem to forget that there&#039;s nothing like wrong comments to set you off on a wild goose chase. If the code has no comments, the comments at least cannot be wrong.</description>
		<content:encoded><![CDATA[<p>People seem to forget that there&#8217;s nothing like wrong comments to set you off on a wild goose chase. If the code has no comments, the comments at least cannot be wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Basu</title>
		<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/comment-page-1/#comment-131</link>
		<dc:creator>Basu</dc:creator>
		<pubDate>Sat, 06 Jun 2009 15:52:53 +0000</pubDate>
		<guid isPermaLink="false">http://makinggoodsoftware.com/?p=436#comment-131</guid>
		<description>I&#039;m afraid I must agree with Wynia. Just the other day I encountered a loop which started iterating over an array from 1 instead of 0 and as a result choked when interacting with client code. I changed it to start from 0 and things seemed to work from 0. The code itself was simple to understand, but I have no way to tell why it was starting from 1 or if I might have broken something else in the process. If the developer was in the habit of always commenting whys he would have paused to think about the start of 1 and written a comment about why it was there. And if it was a mistake, he would have looked over his code to see if it needed explaining and perhaps caught the mistake.
I think we should strive for the right number of comments as opposed to the fewest. It&#039;s better to go a bit overboard than a bit under.</description>
		<content:encoded><![CDATA[<p>I&#8217;m afraid I must agree with Wynia. Just the other day I encountered a loop which started iterating over an array from 1 instead of 0 and as a result choked when interacting with client code. I changed it to start from 0 and things seemed to work from 0. The code itself was simple to understand, but I have no way to tell why it was starting from 1 or if I might have broken something else in the process. If the developer was in the habit of always commenting whys he would have paused to think about the start of 1 and written a comment about why it was there. And if it was a mistake, he would have looked over his code to see if it needed explaining and perhaps caught the mistake.<br />
I think we should strive for the right number of comments as opposed to the fewest. It&#8217;s better to go a bit overboard than a bit under.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J Wynia</title>
		<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/comment-page-1/#comment-130</link>
		<dc:creator>J Wynia</dc:creator>
		<pubDate>Sat, 06 Jun 2009 15:27:49 +0000</pubDate>
		<guid isPermaLink="false">http://makinggoodsoftware.com/?p=436#comment-130</guid>
		<description>Comments are only a repetition if what you put in them is the &quot;what&quot;. The &quot;what&quot; is, indeed, already there in the form of the code. However, the &quot;why&quot; is often pretty much impossible to put directly into the code itself.

Say you&#039;re faced with some credit card processing code that sends all credit card numbers through validation for the CVV2 (that little number on the signature panel), but there&#039;s this extra bit that sends American Express cards around that particular validation.

The kind of code comment you are talking about being repetitive would say something like:

//Bypassing CVV2 validation for American Express cards.

That comment clearly is redundant because code like this already makes that pretty clear:

if(creditCard.CardType == CardTypes.AmericanExpress)
{

} else
{
isValidCVV2 = creditCard.ValidateCVV2();
}


However, when you&#039;re looking at that code, the question you have in your mind is this:

Q: Why is the code not checking the CVV2 number for American Express cards but *is* checking for the rest?

A: Because American Express wants to come on site and do audits if you check that and the product owner would rather pay the higher rate to process the cards than deal with the audit

That answer is what good comments should contain. That can mean that there are large blocks of code without comments (because the &quot;why&quot; is not necessary), but whenever there ARE comments, they should be explaining the &quot;why&quot;, not the &quot;what&quot;. Then, they aren&#039;t repeating yourself.

&quot;What&quot; comments aren&#039;t necessary. &quot;Why&quot; comments are the lifeblood of a maintainable codebase. They let you go to the people who oversee the credit card processing agreement and see if that &quot;why&quot; still holds true when you&#039;re asked to dig into the credit card validation for other reasons and see if it should be left the way it is.</description>
		<content:encoded><![CDATA[<p>Comments are only a repetition if what you put in them is the &#8220;what&#8221;. The &#8220;what&#8221; is, indeed, already there in the form of the code. However, the &#8220;why&#8221; is often pretty much impossible to put directly into the code itself.</p>
<p>Say you&#8217;re faced with some credit card processing code that sends all credit card numbers through validation for the CVV2 (that little number on the signature panel), but there&#8217;s this extra bit that sends American Express cards around that particular validation.</p>
<p>The kind of code comment you are talking about being repetitive would say something like:</p>
<p>//Bypassing CVV2 validation for American Express cards.</p>
<p>That comment clearly is redundant because code like this already makes that pretty clear:</p>
<p>if(creditCard.CardType == CardTypes.AmericanExpress)<br />
{</p>
<p>} else<br />
{<br />
isValidCVV2 = creditCard.ValidateCVV2();<br />
}</p>
<p>However, when you&#8217;re looking at that code, the question you have in your mind is this:</p>
<p>Q: Why is the code not checking the CVV2 number for American Express cards but *is* checking for the rest?</p>
<p>A: Because American Express wants to come on site and do audits if you check that and the product owner would rather pay the higher rate to process the cards than deal with the audit</p>
<p>That answer is what good comments should contain. That can mean that there are large blocks of code without comments (because the &#8220;why&#8221; is not necessary), but whenever there ARE comments, they should be explaining the &#8220;why&#8221;, not the &#8220;what&#8221;. Then, they aren&#8217;t repeating yourself.</p>
<p>&#8220;What&#8221; comments aren&#8217;t necessary. &#8220;Why&#8221; comments are the lifeblood of a maintainable codebase. They let you go to the people who oversee the credit card processing agreement and see if that &#8220;why&#8221; still holds true when you&#8217;re asked to dig into the credit card validation for other reasons and see if it should be left the way it is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 10 commandments for creating good code &#171; Making Good Software</title>
		<link>http://www.makinggoodsoftware.com/2009/06/06/comments-are-evil/comment-page-1/#comment-129</link>
		<dc:creator>10 commandments for creating good code &#171; Making Good Software</dc:creator>
		<pubDate>Sat, 06 Jun 2009 12:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://makinggoodsoftware.com/?p=436#comment-129</guid>
		<description>[...]      9 comments    &#171; Refactoring: The 5 main questions: Why? When? What? How?&#160;Who? Comments are&#160;evil? [...]</description>
		<content:encoded><![CDATA[<p>[...]      9 comments    &laquo; Refactoring: The 5 main questions: Why? When? What? How?&nbsp;Who? Comments are&nbsp;evil? [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
