<?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 considered harmful</title>
	<atom:link href="http://blog.agilephp.com/2008/12/23/comments-considered-harmful/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/</link>
	<description>Dagfinn Reiersøl on PHP, agile development, Ruby and other addictive substances</description>
	<lastBuildDate>Fri, 19 Feb 2010 06:52:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: 網站製作學習誌 &#187; [Web] 連結分享</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-221</link>
		<dc:creator>網站製作學習誌 &#187; [Web] 連結分享</dc:creator>
		<pubDate>Tue, 03 Mar 2009 06:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-221</guid>
		<description>[...] Comments considered harmful [...]</description>
		<content:encoded><![CDATA[<p>[...] Comments considered harmful [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-166</link>
		<dc:creator>Eddie</dc:creator>
		<pubDate>Tue, 30 Dec 2008 22:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-166</guid>
		<description>&lt;p&gt;This blog seems to attract a fair bit of critique - though a few people may have missed the authors point a somewhat. I think the issue here was with the &#039;comments&#039; PHPadvent post (great calendar by the way..) i.e. writing expressive code should be encouraged instead of zealous commenting.&lt;/p&gt;
&lt;p&gt;Anyway I found this post (and discussion) insightful, the key points I take away are:&lt;/p&gt;
&lt;p&gt;- Expressive semantic code is preferable complex code with descriptive comments&lt;br /&gt;
- Not all comments are evil! (RegEX/DocBlock/Modified-by-someone-on-date)&lt;br /&gt;
- Comments could be used as &#039;refactoring indicators&#039;..&lt;/p&gt;
&lt;p&gt;E.g. you could have a plug-in for your editor/IDE that scans your code and highlights all non-regex/Docblock comments and flags them as &#039;refactoring candidates&#039;. It might generate a ToDo list of line-numbers which you could then review and refactor as necessary.&lt;/p&gt;
&lt;p&gt;Maybe that would be useful? I don&#039;t know.. interesting post though, keep it up.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>This blog seems to attract a fair bit of critique &#8211; though a few people may have missed the authors point a somewhat. I think the issue here was with the &#8216;comments&#8217; PHPadvent post (great calendar by the way..) i.e. writing expressive code should be encouraged instead of zealous commenting.</p>
<p>Anyway I found this post (and discussion) insightful, the key points I take away are:</p>
<p>- Expressive semantic code is preferable complex code with descriptive comments<br />
- Not all comments are evil! (RegEX/DocBlock/Modified-by-someone-on-date)<br />
- Comments could be used as &#8216;refactoring indicators&#8217;..</p>
<p>E.g. you could have a plug-in for your editor/IDE that scans your code and highlights all non-regex/Docblock comments and flags them as &#8216;refactoring candidates&#8217;. It might generate a ToDo list of line-numbers which you could then review and refactor as necessary.</p>
<p>Maybe that would be useful? I don&#8217;t know.. interesting post though, keep it up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-165</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Mon, 29 Dec 2008 12:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-165</guid>
		<description>&lt;p&gt;What I&#039;ve done is I&#039;ve made the main logic easier to read (except I haven&#039;t actually done the refactoring, just indicated how it might look). The difference between this and the Wordpress example is that it has no meaningful program logic at all.&lt;/p&gt;
&lt;p&gt;That&#039;s just starting from the top. Then there are opportunities for refactoring the code that, as you point out, I&#039;ve moved into the new methods. The first thing I would do is to reverse the sense of the if statement, changing &lt;/p&gt;
&lt;p&gt;if (!empty($depTables)) {...&lt;/p&gt;
&lt;p&gt;into&lt;/p&gt;
&lt;p&gt;return if(empty($depTables));&lt;/p&gt;
&lt;p&gt;That eliminates a level of nesting.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>What I&#8217;ve done is I&#8217;ve made the main logic easier to read (except I haven&#8217;t actually done the refactoring, just indicated how it might look). The difference between this and the Wordpress example is that it has no meaningful program logic at all.</p>
<p>That&#8217;s just starting from the top. Then there are opportunities for refactoring the code that, as you point out, I&#8217;ve moved into the new methods. The first thing I would do is to reverse the sense of the if statement, changing </p>
<p>if (!empty($depTables)) {&#8230;</p>
<p>into</p>
<p>return if(empty($depTables));</p>
<p>That eliminates a level of nesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vertigo</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-164</link>
		<dc:creator>Vertigo</dc:creator>
		<pubDate>Mon, 29 Dec 2008 10:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-164</guid>
		<description>&lt;p&gt;Hello Dag,&lt;/p&gt;
&lt;p&gt;what did you exactly do in your example? If I understand correctly, you have only created two new methods and moved &quot;uncleaned&quot; code into these methods.&lt;/p&gt;
&lt;p&gt;It reminds me of &quot;fantastic&quot; Wordpress&#039; index.php:&lt;/p&gt;
&lt;p&gt;define(&#039;WP_USE_THEMES&#039;, true);&lt;br /&gt;
require(&#039;./wp-blog-header.php&#039;);&lt;/p&gt;
&lt;p&gt;Nice!! All garbage is gone ...&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hello Dag,</p>
<p>what did you exactly do in your example? If I understand correctly, you have only created two new methods and moved &#8220;uncleaned&#8221; code into these methods.</p>
<p>It reminds me of &#8220;fantastic&#8221; Wordpress&#8217; index.php:</p>
<p>define(&#8216;WP_USE_THEMES&#8217;, true);<br />
require(&#8216;./wp-blog-header.php&#8217;);</p>
<p>Nice!! All garbage is gone &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nico</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-163</link>
		<dc:creator>nico</dc:creator>
		<pubDate>Fri, 26 Dec 2008 14:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-163</guid>
		<description>&lt;p&gt;&gt; comments are only signs that your code are breaking OO principles (Single Responsability, etc.) and that your code is not clear enough to be understood.&lt;/p&gt;
&lt;p&gt;No, comments are there to comment. Period.&lt;br /&gt;
That has nothing to do with how good is your code.&lt;br /&gt;
You can write perfectcly clean code and add good comments to it. Nothing wrong with that.&lt;/p&gt;
&lt;p&gt;You can&#039;t generalize on these things. &lt;/p&gt;
&lt;p&gt;In certain cases a rough quick routine that maybe doesn&#039;t follow the golden sacred rules of good programming can be faster and more efficient than one that is maybe easier to read and perfect by any standard of programming.&lt;br /&gt;
Sometimes you need efficiency over pretty code. And good commented efficient ugly code is good in that case.&lt;br /&gt;
Sometimes you have a gigantic project and you need clean code if you want to maintain it. Still, also in that case good comments are good to have.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>&gt; comments are only signs that your code are breaking OO principles (Single Responsability, etc.) and that your code is not clear enough to be understood.</p>
<p>No, comments are there to comment. Period.<br />
That has nothing to do with how good is your code.<br />
You can write perfectcly clean code and add good comments to it. Nothing wrong with that.</p>
<p>You can&#8217;t generalize on these things. </p>
<p>In certain cases a rough quick routine that maybe doesn&#8217;t follow the golden sacred rules of good programming can be faster and more efficient than one that is maybe easier to read and perfect by any standard of programming.<br />
Sometimes you need efficiency over pretty code. And good commented efficient ugly code is good in that case.<br />
Sometimes you have a gigantic project and you need clean code if you want to maintain it. Still, also in that case good comments are good to have.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kimble</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-162</link>
		<dc:creator>Kimble</dc:creator>
		<pubDate>Fri, 26 Dec 2008 12:59:40 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-162</guid>
		<description>&lt;p&gt;I think I&#039;ve seen this presentation on JavaZone. The comments become harmful when you change things further down in your method-call-stack without changing comments higher up in the stack. &lt;/p&gt;
&lt;p&gt;The presentation had some believable examples describing apparently innocent changes way down in the code witch in turn made comments higher up very wrong. &lt;/p&gt;
&lt;p&gt;The only thing worse than (bad?) code without comments is code with comments that&#039;s wrong!&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I think I&#8217;ve seen this presentation on JavaZone. The comments become harmful when you change things further down in your method-call-stack without changing comments higher up in the stack. </p>
<p>The presentation had some believable examples describing apparently innocent changes way down in the code witch in turn made comments higher up very wrong. </p>
<p>The only thing worse than (bad?) code without comments is code with comments that&#8217;s wrong!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagfinn</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-161</link>
		<dc:creator>dagfinn</dc:creator>
		<pubDate>Fri, 26 Dec 2008 07:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-161</guid>
		<description>&lt;p&gt;I have read that before. I fully understand the argument and agree with it in general terms. In particular, I agree with the idea that &#039;the writing of a &quot;considered harmful&quot; essay often serves to inflame whatever debate is in progress..&#039;&lt;/p&gt;
&lt;p&gt;In this case though, there seems to be no debate in progress in the first place. I am trying to make my point strongly enough that people will at least notice it.&lt;/p&gt;
&lt;p&gt;If the rest of the blog post had been over the top, then I would probably have been shooting myself in the foot.&lt;br /&gt;
I don&#039;t think it is, though.&lt;/p&gt;
&lt;p&gt;On the other hand, the amount of interest that&#039;s being focused on the title rather than the actual content of the blog post could indicate that it wasn&#039;t a wise choice.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I have read that before. I fully understand the argument and agree with it in general terms. In particular, I agree with the idea that &#8216;the writing of a &#8220;considered harmful&#8221; essay often serves to inflame whatever debate is in progress..&#8217;</p>
<p>In this case though, there seems to be no debate in progress in the first place. I am trying to make my point strongly enough that people will at least notice it.</p>
<p>If the rest of the blog post had been over the top, then I would probably have been shooting myself in the foot.<br />
I don&#8217;t think it is, though.</p>
<p>On the other hand, the amount of interest that&#8217;s being focused on the title rather than the actual content of the blog post could indicate that it wasn&#8217;t a wise choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-160</link>
		<dc:creator>Sander</dc:creator>
		<pubDate>Thu, 25 Dec 2008 23:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-160</guid>
		<description>&lt;p&gt;If ever there was a posting to which the &quot;Considered Harmful&quot; Essays Considered Harmful posting - http://meyerweb.com/eric/comment/chech.html - applied, it&#039;s this one.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>If ever there was a posting to which the &#8220;Considered Harmful&#8221; Essays Considered Harmful posting &#8211; <a href="http://meyerweb.com/eric/comment/chech.html" rel="nofollow">http://meyerweb.com/eric/comment/chech.html</a> &#8211; applied, it&#8217;s this one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem Nezvigin</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-159</link>
		<dc:creator>Artem Nezvigin</dc:creator>
		<pubDate>Thu, 25 Dec 2008 17:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-159</guid>
		<description>&lt;p&gt;I use comments primarily above functions and method declarations for generating documentation. This is VERY important to me and often times is enough information for me to understand what a method/function is meant to do.&lt;/p&gt;
&lt;p&gt;I think I&#039;m going to start using variables that are more readable like you suggest. Often times I name my variables using the context of where they are. So an array of news posts would be $posts instead of $news_posts. Going over 15 characters is overkill though and I&#039;ll aim to not do that.&lt;/p&gt;
&lt;p&gt;For those disagreeing with the concept outlined by the author, try to see it for what it is and apply as much as you can. Be open to new ideas!&lt;/p&gt;
&lt;p&gt;In my case, I would never completely remove comments from my code but I will focus on making the code readable enough so that comments aren&#039;t always necessary. Even if it makes 10% of my code more readable since I&#039;m thinking about the concept while writing the code -- awesome!&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I use comments primarily above functions and method declarations for generating documentation. This is VERY important to me and often times is enough information for me to understand what a method/function is meant to do.</p>
<p>I think I&#8217;m going to start using variables that are more readable like you suggest. Often times I name my variables using the context of where they are. So an array of news posts would be $posts instead of $news_posts. Going over 15 characters is overkill though and I&#8217;ll aim to not do that.</p>
<p>For those disagreeing with the concept outlined by the author, try to see it for what it is and apply as much as you can. Be open to new ideas!</p>
<p>In my case, I would never completely remove comments from my code but I will focus on making the code readable enough so that comments aren&#8217;t always necessary. Even if it makes 10% of my code more readable since I&#8217;m thinking about the concept while writing the code &#8212; awesome!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://blog.agilephp.com/2008/12/23/comments-considered-harmful/comment-page-1/#comment-158</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Wed, 24 Dec 2008 23:46:49 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/wordpress/?p=1383#comment-158</guid>
		<description>&lt;p&gt;@nico: comments are only signs that your code are breaking OO principles (Single Responsability, etc.) and that your code is not clear enough to be understood.&lt;/p&gt;
&lt;p&gt;For the people who want to improve their knowledge and who do not understand why commenting is a sign of weakness, I can recommand the following articles:&lt;/p&gt;
&lt;p&gt;- http://www.objectmentor.com/resources/publishedArticles.html&lt;br /&gt;
(especially under &quot;design principles&quot;, &quot;Object Oriented Design&quot;, &quot;Refactoring&quot;, etc.)&lt;/p&gt;
&lt;p&gt;- Misko Hevery&#039;s blog (A google evangelist) http://misko.hevery.com/&lt;/p&gt;
&lt;p&gt;Comment is usefull when:&lt;br /&gt;
- it is used by programm to autogenerate documentation&lt;br /&gt;
- it is used by your IDE&lt;br /&gt;
- You write ugly code for external constraint (performance reason, etc.)&lt;br /&gt;
- ...?&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>@nico: comments are only signs that your code are breaking OO principles (Single Responsability, etc.) and that your code is not clear enough to be understood.</p>
<p>For the people who want to improve their knowledge and who do not understand why commenting is a sign of weakness, I can recommand the following articles:</p>
<p>- <a href="http://www.objectmentor.com/resources/publishedArticles.html" rel="nofollow">http://www.objectmentor.com/resources/publishedArticles.html</a><br />
(especially under &#8220;design principles&#8221;, &#8220;Object Oriented Design&#8221;, &#8220;Refactoring&#8221;, etc.)</p>
<p>- Misko Hevery&#8217;s blog (A google evangelist) <a href="http://misko.hevery.com/" rel="nofollow">http://misko.hevery.com/</a></p>
<p>Comment is usefull when:<br />
- it is used by programm to autogenerate documentation<br />
- it is used by your IDE<br />
- You write ugly code for external constraint (performance reason, etc.)<br />
- &#8230;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
