<?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: Show me your code comments and I&#8217;ll show why you don&#8217;t need them</title>
	<atom:link href="http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/</link>
	<description>Dagfinn Reiersøl on PHP, agile development, Ruby and other addictive substances</description>
	<lastBuildDate>Fri, 23 Jul 2010 20:17:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bruce</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-809</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Wed, 19 May 2010 16:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-809</guid>
		<description>@Dave: To me, your argument seems to be that when you extract a method, you have something potentially reusable, and when it&#039;s reusable it can be reused in a wrong way. Well, I think the benefit of having reusable code available far outweighs the risk of &quot;abuse&quot;.

You say &quot;..if it doesn&#039;t make sense to do that code block in isolation from its caller...&quot;. Why would anyone do it if it doesn&#039;t make sense? If someone tries to use that method in a different context, it&#039;s probably because it does make sense. But obviously they can&#039;t assume that it will work perfectly right away. Still, they&#039;re better off trying than writing duplicate code.

The more interesting question is, what can you do to make the method and the class less likely to fail when it&#039;s reused? That&#039;s where terms like decoupling become relevant.</description>
		<content:encoded><![CDATA[<p>@Dave: To me, your argument seems to be that when you extract a method, you have something potentially reusable, and when it&#8217;s reusable it can be reused in a wrong way. Well, I think the benefit of having reusable code available far outweighs the risk of &#8220;abuse&#8221;.</p>
<p>You say &#8220;..if it doesn&#8217;t make sense to do that code block in isolation from its caller&#8230;&#8221;. Why would anyone do it if it doesn&#8217;t make sense? If someone tries to use that method in a different context, it&#8217;s probably because it does make sense. But obviously they can&#8217;t assume that it will work perfectly right away. Still, they&#8217;re better off trying than writing duplicate code.</p>
<p>The more interesting question is, what can you do to make the method and the class less likely to fail when it&#8217;s reused? That&#8217;s where terms like decoupling become relevant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Community News: Comments on Commenting &#124; Cole Design Studios</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-453</link>
		<dc:creator>Community News: Comments on Commenting &#124; Cole Design Studios</dc:creator>
		<pubDate>Mon, 04 May 2009 17:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-453</guid>
		<description>[...] Reiersol takes a more pragmatic approach to the issue and wants to see the code before making a decision on whether the comments are needed or [...]</description>
		<content:encoded><![CDATA[<p>[...] Reiersol takes a more pragmatic approach to the issue and wants to see the code before making a decision on whether the comments are needed or [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: In Defense Of Commenting &#124; BrandonSavage.net</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-452</link>
		<dc:creator>In Defense Of Commenting &#124; BrandonSavage.net</dc:creator>
		<pubDate>Mon, 04 May 2009 16:35:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-452</guid>
		<description>[...] article from last week, &#8220;On Code Commenting and Technical Debt&#8221; raised a lot of response throughout the community. I think that discussion is great, and I&#8217;m all for a debate that [...]</description>
		<content:encoded><![CDATA[<p>[...] article from last week, &#8220;On Code Commenting and Technical Debt&#8221; raised a lot of response throughout the community. I think that discussion is great, and I&#8217;m all for a debate that [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-444</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 04 May 2009 08:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-444</guid>
		<description>When writing comments you should treat them like you&#039;re telling of a historial fact. You can tell when someone writes subjective comments, and that&#039;s indeed not the right way to go IF the intentions of the author deviate from the actual purpose of the code.

However, if you&#039;re working with a team of developers and you have to spend time in eachother&#039;s code from time to time you&#039;ll be glad that they&#039;re there. If you have to make adjustments to a 400-line function and all the comments you got are the ones in the PHPDoc, the chances are you&#039;re going to try look for &quot;clues&quot; in the rest of the class as to how some variables are treated. Proper naming conventions help a lot in this case, but usually you want that extra bit of information.

On the point of commenting for yourself, I&#039;ll go with Brandon&#039;s point of view. If you write several thousand lines of code each week you&#039;re bound to forget how a certain function you wrote 4 months ago was made.</description>
		<content:encoded><![CDATA[<p>When writing comments you should treat them like you&#8217;re telling of a historial fact. You can tell when someone writes subjective comments, and that&#8217;s indeed not the right way to go IF the intentions of the author deviate from the actual purpose of the code.</p>
<p>However, if you&#8217;re working with a team of developers and you have to spend time in eachother&#8217;s code from time to time you&#8217;ll be glad that they&#8217;re there. If you have to make adjustments to a 400-line function and all the comments you got are the ones in the PHPDoc, the chances are you&#8217;re going to try look for &#8220;clues&#8221; in the rest of the class as to how some variables are treated. Proper naming conventions help a lot in this case, but usually you want that extra bit of information.</p>
<p>On the point of commenting for yourself, I&#8217;ll go with Brandon&#8217;s point of view. If you write several thousand lines of code each week you&#8217;re bound to forget how a certain function you wrote 4 months ago was made.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-388</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Fri, 01 May 2009 20:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-388</guid>
		<description>Code that&#039;s hard to understand without comments will be improved by adding comments. That much we agree on. And, yes, the comments may be helpful when refactoring. That is, if they haven&#039;t deteriorated to the point where they become misleading.</description>
		<content:encoded><![CDATA[<p>Code that&#8217;s hard to understand without comments will be improved by adding comments. That much we agree on. And, yes, the comments may be helpful when refactoring. That is, if they haven&#8217;t deteriorated to the point where they become misleading.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-387</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Fri, 01 May 2009 18:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-387</guid>
		<description>One of the biggest reasons I still comment, though it didn&#039;t fit with my argument regarding technical debt, is that my memory is imperfect. Writing a comment about a particularly unusual line of code or about the logic I used is often a perfect reminder to me about why I did something or how I did something.

I honestly think that commenting code is a practice that operates shop-by-shop, and the standards should reflect the developers and their personalities. I doubt there&#039;s one &quot;correct&quot; way to comment your code, just like there&#039;s not one &quot;correct&quot; version control system or one &quot;correct&quot; bug tracker. It&#039;s preference-based.

My article reflects my personal view on commenting but is by no means authoritative on the subject as a whole. That said, commenting underperforming code *will* help you pay down that technical debt when the refactor comes, because you&#039;ll have an easier time understanding it and perhaps the comments will lead you to it. 

And if you tell me that you write no underperforming code ever, well, then I don&#039;t know what to tell you...</description>
		<content:encoded><![CDATA[<p>One of the biggest reasons I still comment, though it didn&#8217;t fit with my argument regarding technical debt, is that my memory is imperfect. Writing a comment about a particularly unusual line of code or about the logic I used is often a perfect reminder to me about why I did something or how I did something.</p>
<p>I honestly think that commenting code is a practice that operates shop-by-shop, and the standards should reflect the developers and their personalities. I doubt there&#8217;s one &#8220;correct&#8221; way to comment your code, just like there&#8217;s not one &#8220;correct&#8221; version control system or one &#8220;correct&#8221; bug tracker. It&#8217;s preference-based.</p>
<p>My article reflects my personal view on commenting but is by no means authoritative on the subject as a whole. That said, commenting underperforming code *will* help you pay down that technical debt when the refactor comes, because you&#8217;ll have an easier time understanding it and perhaps the comments will lead you to it. </p>
<p>And if you tell me that you write no underperforming code ever, well, then I don&#8217;t know what to tell you&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-386</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Fri, 01 May 2009 12:31:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-386</guid>
		<description>@Dave: To me, your argument seems to be that when you extract a method, you have something potentially reusable, and when it&#039;s reusable it can be reused in a wrong way. Well, I think the benefit of having reusable code available far outweighs the risk of &quot;abuse&quot;.

You say &quot;..if it doesn&#039;t make sense to do that code block in isolation from its caller...&quot;. Why would anyone do it if it doesn&#039;t make sense? If someone tries to use that method in a different context, it&#039;s probably because it does make sense. But obviously they can&#039;t assume that it will work perfectly right away. Still, they&#039;re better off trying than writing duplicate code.

The more interesting question is, what can you do to make the method and the class less likely to fail when it&#039;s reused? That&#039;s where terms like decoupling become relevant.</description>
		<content:encoded><![CDATA[<p>@Dave: To me, your argument seems to be that when you extract a method, you have something potentially reusable, and when it&#8217;s reusable it can be reused in a wrong way. Well, I think the benefit of having reusable code available far outweighs the risk of &#8220;abuse&#8221;.</p>
<p>You say &#8220;..if it doesn&#8217;t make sense to do that code block in isolation from its caller&#8230;&#8221;. Why would anyone do it if it doesn&#8217;t make sense? If someone tries to use that method in a different context, it&#8217;s probably because it does make sense. But obviously they can&#8217;t assume that it will work perfectly right away. Still, they&#8217;re better off trying than writing duplicate code.</p>
<p>The more interesting question is, what can you do to make the method and the class less likely to fail when it&#8217;s reused? That&#8217;s where terms like decoupling become relevant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-385</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 01 May 2009 11:45:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-385</guid>
		<description>The other problem of course with pulling methods out is that someone can then later call that method from an unexpected place, where assumed prconditions are not met for example. Visibility scope isnt necesarily a fix for this either since when extending functionality you&#039;ll invariably have access to the new method. Visibility is really more a solution for separating interface from implentation.

A method should encapsulate a unit of reuse, if it doesnt make sense to do that code block in isolation from its caller then it shouldnt be a separate method.</description>
		<content:encoded><![CDATA[<p>The other problem of course with pulling methods out is that someone can then later call that method from an unexpected place, where assumed prconditions are not met for example. Visibility scope isnt necesarily a fix for this either since when extending functionality you&#8217;ll invariably have access to the new method. Visibility is really more a solution for separating interface from implentation.</p>
<p>A method should encapsulate a unit of reuse, if it doesnt make sense to do that code block in isolation from its caller then it shouldnt be a separate method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-384</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Fri, 01 May 2009 10:56:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-384</guid>
		<description>As for the idea that commenting requires practically zero effort, I disagree. It&#039;s just like any other explanatory text. Making sure it&#039;s accurate and communicates well is real work. And it&#039;s even more difficult to remember to update comments correctly, which is why it&#039;s frequently not done and comments turn out to be actively misleading and therefore worse than no comments.</description>
		<content:encoded><![CDATA[<p>As for the idea that commenting requires practically zero effort, I disagree. It&#8217;s just like any other explanatory text. Making sure it&#8217;s accurate and communicates well is real work. And it&#8217;s even more difficult to remember to update comments correctly, which is why it&#8217;s frequently not done and comments turn out to be actively misleading and therefore worse than no comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2009/04/30/show-me-your-code-comments-and-ill-show-why-you-dont-need-them/comment-page-1/#comment-383</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Fri, 01 May 2009 10:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.agilephp.com/?p=1567#comment-383</guid>
		<description>The objection about onion code is somewhat valid, but if it gets that bad the problem is probably that you haven&#039;t got your abstractions straight. If you just have lots of methods and they&#039;re not logically organized into classes, you will get that kind of problem. I will grant you that that may be more difficult than just extracting methods. One important piece of that puzzle is what Neal Ford calls SLAP (Single Level of Abstraction Principle) as in the presentation I was referring to in my previous blog post.</description>
		<content:encoded><![CDATA[<p>The objection about onion code is somewhat valid, but if it gets that bad the problem is probably that you haven&#8217;t got your abstractions straight. If you just have lots of methods and they&#8217;re not logically organized into classes, you will get that kind of problem. I will grant you that that may be more difficult than just extracting methods. One important piece of that puzzle is what Neal Ford calls SLAP (Single Level of Abstraction Principle) as in the presentation I was referring to in my previous blog post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
