<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP in Action &#187; Martin Fowler</title>
	<atom:link href="http://blog.agilephp.com/tag/martin-fowler/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agilephp.com</link>
	<description>Dagfinn Reiersøl on PHP, agile development, Ruby and other addictive substances</description>
	<lastBuildDate>Mon, 28 Sep 2009 14:35:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Show me your code comments and I&#8217;ll show why you don&#8217;t need them</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/</link>
		<comments>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 20:52:45 +0000</pubDate>
		<dc:creator>dagfinn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Martin Fowler]]></category>
		<category><![CDATA[Technical debt]]></category>
		<category><![CDATA[Ward Cunningham]]></category>

		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567</guid>
		<description><![CDATA[Brandon Savage has written a blog post On Code Commenting And Technical Debt. He believes that code comments are a good way to minimize technical debt.

I&#8217;m surprised to find the term technical debt mentioned without being accompanied by the term refactoring. Refactoring is generally recognized (outside the PHP world) as the way to pay down [...]]]></description>
			<content:encoded><![CDATA[<p>Brandon Savage has written a blog post <a href="http://www.brandonsavage.net/on-code-commenting-and-technical-debt/">On Code Commenting And Technical Debt</a>. He believes that code comments are a good way to minimize <a class="zem_slink" title="Technical debt" rel="wikipedia" href="http://en.wikipedia.org/wiki/Technical_debt">technical debt</a>.<br />
<a href="http://www.brandonsavage.net/on-code-commenting-and-technical-debt/"></a><br />
I&#8217;m surprised to find the term technical debt mentioned without being accompanied by the term <a class="zem_slink" title="Code refactoring" rel="wikipedia" href="http://en.wikipedia.org/wiki/Code_refactoring">refactoring</a>. Refactoring is generally recognized (outside the PHP world) as <em>the</em> way to pay down technical debt. Commenting may help, but is clearly the second-best practice.</p>
<p><a href="http://martinfowler.com/bliki/TechnicalDebt.html">Martin Fowler</a> puts it this way:</p>
<blockquote><p>Technical Debt is a wonderful metaphor developed by <a class="zem_slink" title="Ward Cunningham" rel="wikipedia" href="http://en.wikipedia.org/wiki/Ward_Cunningham">Ward Cunningham</a> to help us think about this problem. In this metaphor, doing things the quick and dirty way sets us up with a technical debt, which is similar to a financial debt. Like a financial debt, the technical debt incurs interest payments, which come in the form of the extra effort that we have to do in future development because of the quick and dirty design choice. We can choose to continue paying the interest, or we can pay down the principal by refactoring the quick and dirty design into the better design. Although it costs to pay down the principal, we gain by reduced interest payments in the future.</p></blockquote>
<p>Brandon&#8217;s argument in favor of commenting is perfectly valid, but misses the crux of the matter, since he ignores the option of actually improving the code itself rather than just adding comments.</p>
<p>Let me also comment briefly on <a href="http://mtabini.blogspot.com/2009/04/myth-of-myth-of-self-commenting-code.html">Marco Tabini&#8217;s reponse</a>:</p>
<blockquote><p>What I suspect Brandon really means is that the comments are there to illustrate the intentions of the author <span style="font-style: italic;">when those intentions are not immediately made obvious by the code itself</span>.</p></blockquote>
<p>Yes. And no. There is no absolute boundary, no limit in principle, to how <a href="http://c2.com/cgi/wiki/wiki?IntentionRevealingNames">intention-revealing</a> code can be. It&#8217;s not necessarily easy in practice, though. As I&#8217;ve said before, it&#8217;s primarily inline comments that I&#8217;m objecting to. The comments I feel a need to write are often at the class level and address the interaction between different classes.</p>
<p>Anyway, arguing about it theoretically is not the way to resolve the issue. Show me some good examples of comments that serve to make code clearer and that supposedly can&#8217;t be usefully eliminated by refactoring the code into something more readable. I&#8217;ll either admit that you&#8217;re right or show you (or at least outline) how to do it differently. I do recognize that even inline comments are useful&#8230;<em>occasionally</em>.<a href="http://mtabini.blogspot.com/2009/04/myth-of-myth-of-self-commenting-code.html"></a></p>
<p>(By the way, I seem to have missed Brandon&#8217;s comment (<a href="http://www.brandonsavage.net/where-comments-are-useful/">Where Comments Are Useful</a>) to my <a href="http://blog.agilephp.com/2008/12/23/comments-considered-harmful/">comments considered harmful</a> post last December.)</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=PHP%20in%20Action&amp;siteurl=http%3A%2F%2Fblog.agilephp.com%2F&amp;linkname=Show%20me%20your%20code%20comments%20and%20I%26%238217%3Bll%20show%20why%20you%20don%26%238217%3Bt%20need%20them&amp;linkurl=http%3A%2F%2Fblog.agilephp.com%2F2009%2F04%2F30%2Fshow-me-your-code-comments-and-ill-show-why-you-dont-need-them%2F"><img src="http://blog.agilephp.com/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
