<?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; Source code</title>
	<atom:link href="http://blog.agilephp.com/tag/source-code/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>Most confused discussion in the known universe</title>
		<link>http://blog.agilephp.com/2009/05/02/most-confused-discussion-in-the-known-universe/</link>
		<comments>http://blog.agilephp.com/2009/05/02/most-confused-discussion-in-the-known-universe/#comments</comments>
		<pubDate>Sat, 02 May 2009 20:03:12 +0000</pubDate>
		<dc:creator>dagfinn</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Source code]]></category>

		<guid isPermaLink="false">http://blog.agilephp.com/?p=1573</guid>
		<description><![CDATA[



Image by B Tal via Flickr



How confused can a discussion get? As confused as the discussion in the comments to Benjamin Eberlei&#8217;s Explicit Code requires no comments &#8211; Only bad code does. This discussion has a fake identity, and nobody seems to notice. As you can see, the blog post claims to be about code [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignleft" style="width: 250px;">
<dt class="wp-caption-dt"><a href="http://www.flickr.com/photos/68634595@N00/163450213"><img title="If You're Not Confused" src="http://farm1.static.flickr.com/73/163450213_18478d3aa6_m.jpg" alt="If You're Not Confused" width="240" height="160" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image by <a href="http://www.flickr.com/photos/68634595@N00/163450213">B Tal</a> via Flickr</dd>
</dl>
</div>
</div>
<p>How confused can a discussion get? As confused as the discussion in the comments to Benjamin Eberlei&#8217;s <a href="http://www.whitewashing.de/blog/articles/116">Explicit Code requires no comments &#8211; Only bad code does</a>. This discussion has a fake identity, and nobody seems to notice<strong>.</strong> As you can see, the blog post claims to be about code comments, but it isn&#8217;t. The example given does not adress the issue of commenting. In the refactored version, Benjamin has not removed the comment from the original, and done nothing (OK, a tiny bit) to replace it with expressive code.  Since the example is irrelevant to the subject matter, it fails to keep the discussion grounded, allowing it to degenerate into dogmatic opinion and subjective speculation.</p>
<p>Also contributing to the confusion is an apparent lack of understanding of the process of refactoring. Refactoring is not a deterministic process, nor is it a strait jacket. You have choice, and you should learn to exercise it judiciously. You take a chunk of code, change it somewhat, and then you decide whether there&#8217;s actually been an improvement. If there hasn&#8217;t, as many think in this case (and I&#8217;m somewhat inclined to agree with them, although Benjamin has great principles and valid points), you have three choices:</p>
<ol>
<li>Refactor further, hoping to arrive at something more satisfactory.</li>
<li>Undo the change and try something else.</li>
<li>Undo the change and keep the original version if you think that&#8217;s the best you can do.</li>
</ol>
<p>These are the normal choices for those of us who refactor routinely. It happens often enough. Even if you undo the change, it doesn&#8217;t necessarily mean you&#8217;ve wasted your time. You&#8217;ve probably learned something.</p>
<p>In this case, too, there is a chance to learn something worthwhile if you can distance yourself from the noisy confrontation. The most obvious thing to observe is that trying to extract methods from a 6-7 line method is a suicide mission in the circumstances. It&#8217;s bound to increase the volume of code <em>a lot</em>, and it&#8217;s only natural that the result gets labeled &#8220;bloated&#8221;. If you do something similar with a longer method, the percentage increase is much less, and you have a chance of not drowning in irrelevant criticism.</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=Most%20confused%20discussion%20in%20the%20known%20universe&amp;linkurl=http%3A%2F%2Fblog.agilephp.com%2F2009%2F05%2F02%2Fmost-confused-discussion-in-the-known-universe%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/05/02/most-confused-discussion-in-the-known-universe/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
