<?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: Don&#8217;t comment your code</title>
	<atom:link href="http://www.francodacosta.com/development/dont-comment-your-code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.francodacosta.com/development/dont-comment-your-code</link>
	<description>because it is!</description>
	<lastBuildDate>Fri, 04 May 2012 07:08:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Pete</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-7916</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 22 Sep 2011 23:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-7916</guid>
		<description>The problem isn&#039;t you coming back to your own code. You comment for the poor sap that has to modify your code 2 or 3 years from now and you are long since gone and if you dont think this is important, you haven&#039;t been burned by the egotistical SOB who thinks his code is so perfect and elegant that it is self documenting and adding a comment would detract from its beauty.  Like most things from a narcissist, it&#039;s only beautiful to them and to the rest of the world its sphagetti code.  

I fire programmers who don&#039;t document the module, the function, its parameters and return values and every decision point.</description>
		<content:encoded><![CDATA[<p>The problem isn&#8217;t you coming back to your own code. You comment for the poor sap that has to modify your code 2 or 3 years from now and you are long since gone and if you dont think this is important, you haven&#8217;t been burned by the egotistical SOB who thinks his code is so perfect and elegant that it is self documenting and adding a comment would detract from its beauty.  Like most things from a narcissist, it&#8217;s only beautiful to them and to the rest of the world its sphagetti code.  </p>
<p>I fire programmers who don&#8217;t document the module, the function, its parameters and return values and every decision point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-7802</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Tue, 13 Sep 2011 11:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-7802</guid>
		<description>Comments are basically a way of the developer saying i can&#039;t describe what this function does with a simple name so i&#039;m gonna have to document the intricacies for my future self just in case i forget.

The solution for this type of problem was created many years ago

&quot;Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.&quot;
- Doug McIlroy

Split the problem to the point until it becomes self-documenting.</description>
		<content:encoded><![CDATA[<p>Comments are basically a way of the developer saying i can&#8217;t describe what this function does with a simple name so i&#8217;m gonna have to document the intricacies for my future self just in case i forget.</p>
<p>The solution for this type of problem was created many years ago</p>
<p>&#8220;Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.&#8221;<br />
- Doug McIlroy</p>
<p>Split the problem to the point until it becomes self-documenting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m4niac</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-4335</link>
		<dc:creator>m4niac</dc:creator>
		<pubDate>Sat, 09 Oct 2010 05:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-4335</guid>
		<description>makes perfect sense to me :) totally agree. thanx</description>
		<content:encoded><![CDATA[<p>makes perfect sense to me <img src='http://www.francodacosta.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  totally agree. thanx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crazy12</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-452</link>
		<dc:creator>Crazy12</dc:creator>
		<pubDate>Sun, 11 Oct 2009 01:45:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-452</guid>
		<description>This means that traffic is backed way the hell up. ,</description>
		<content:encoded><![CDATA[<p>This means that traffic is backed way the hell up. ,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brant Peery</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-218</link>
		<dc:creator>Brant Peery</dc:creator>
		<pubDate>Wed, 16 Sep 2009 15:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-218</guid>
		<description>I agree with nuno costa on this. With that said though, there are way to many &#039;programmers&#039; out there that under comment their code. The biggest problem with that is that they are also sloppy programmers. They rarely follow any best practices and the methodology is a bit out of the ordinary. So it becomes very hard to follow the code in your mind. I have even encountered situations where the hackjob doesn&#039;t even match what the developer intended. It just kinda worked somehow and so they stopped hacking at it. This would be an excellent example of a place where commenting the intentions of what the developer was trying to accomplish with each line or set of lines would be helpful. 
But if a developer can follow best practices and said developer uses common methods of accomplishing things then he shouldn&#039;t need to comment what just about any beginner to average developer in that same language would understand about that line of code. That becomes redundant and wasteful. Unless of course he expects beginners to read or maintain the code. Then comments will be used to teach. But that is not normally the case.
I do believe that if code is used that is out of the ordinary or more advanced than the average programmer that might look at that code (even if it is the developer himself) then the more comments the merrier. I have often looked back at code that I implemented and been grateful that I didn&#039;t have to do the research again. Sometimes it really helps to have included such good notes (comments) in my code.</description>
		<content:encoded><![CDATA[<p>I agree with nuno costa on this. With that said though, there are way to many &#8216;programmers&#8217; out there that under comment their code. The biggest problem with that is that they are also sloppy programmers. They rarely follow any best practices and the methodology is a bit out of the ordinary. So it becomes very hard to follow the code in your mind. I have even encountered situations where the hackjob doesn&#8217;t even match what the developer intended. It just kinda worked somehow and so they stopped hacking at it. This would be an excellent example of a place where commenting the intentions of what the developer was trying to accomplish with each line or set of lines would be helpful.<br />
But if a developer can follow best practices and said developer uses common methods of accomplishing things then he shouldn&#8217;t need to comment what just about any beginner to average developer in that same language would understand about that line of code. That becomes redundant and wasteful. Unless of course he expects beginners to read or maintain the code. Then comments will be used to teach. But that is not normally the case.<br />
I do believe that if code is used that is out of the ordinary or more advanced than the average programmer that might look at that code (even if it is the developer himself) then the more comments the merrier. I have often looked back at code that I implemented and been grateful that I didn&#8217;t have to do the research again. Sometimes it really helps to have included such good notes (comments) in my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nuno costa</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-71</link>
		<dc:creator>nuno costa</dc:creator>
		<pubDate>Fri, 21 Aug 2009 01:35:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-71</guid>
		<description>&lt;p&gt;Hi Ricardo,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Itâ€™s not about being lazy, Itâ€™s about being clear, although I consider laziness to be a good quality for a developer but that is a subject to another discussion.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I tried to sum it up on the last paragraph, I like comments, and think they are important, Iâ€™m just against excessive comments.&lt;/p&gt;

&lt;p&gt;A comment should be a guide, a hint, to what that peace of code does, not step by step intructions.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Let me give you an example of what I thinks is ok and whatâ€™s not.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;pre lang=&quot;php&quot;&gt;/*

*  This function retrieves the comments for a given post

* @param postId integer

* @returns: collection of posts

*/

function getComments($postId){

    &lt;some code&gt;

    //some important note about the following code

    &lt;more code&gt;

}&lt;/pre&gt;

&lt;p&gt;to me this acceptable and desired!&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;pre lang=&quot;php&quot;&gt;function getComments($postId){

   //connecting to db server

   mysql_connect()

   //selecting database

   mysql_select_db()

   //preparing sql

   $sql=â€¦

   //execute sql statment

   mysql_query()

   //looping trough records and get something

   while(){

 

    }

}

 
&lt;/pre&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Can you see the difference ?&lt;/p&gt;

&lt;p&gt;If you where to maintain an application how would you like to have the code ?&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;You should comment only when itâ€™s meaningful otherwise you are just making your code dirty and hard to follow&lt;/p&gt;

&lt;p&gt;By the way, I really like your email address :P&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi Ricardo,</p>
<p>&#160;</p>
<p>Itâ€™s not about being lazy, Itâ€™s about being clear, although I consider laziness to be a good quality for a developer but that is a subject to another discussion.</p>
<p>&#160;</p>
<p>I tried to sum it up on the last paragraph, I like comments, and think they are important, Iâ€™m just against excessive comments.</p>
<p>A comment should be a guide, a hint, to what that peace of code does, not step by step intructions.</p>
<p>&#160;</p>
<p>Let me give you an example of what I thinks is ok and whatâ€™s not.</p>
<p>&#160;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
&nbsp;
*  This function retrieves the comments for a given post
&nbsp;
* @param postId integer
&nbsp;
* @returns: collection of posts
&nbsp;
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getComments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>some code<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//some important note about the following code</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>more code<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>to me this acceptable and desired!</p>
<p>&#160;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getComments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//connecting to db server</span>
&nbsp;
   <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//selecting database</span>
&nbsp;
   <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//preparing sql</span>
&nbsp;
   <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span>â€¦
&nbsp;
   <span style="color: #666666; font-style: italic;">//execute sql statment</span>
&nbsp;
   <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//looping trough records and get something</span>
&nbsp;
   <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>&#160;</p>
<p>Can you see the difference ?</p>
<p>If you where to maintain an application how would you like to have the code ?</p>
<p>&#160;</p>
<p>You should comment only when itâ€™s meaningful otherwise you are just making your code dirty and hard to follow</p>
<p>By the way, I really like your email address <img src='http://www.francodacosta.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricardo Amaral</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-67</link>
		<dc:creator>Ricardo Amaral</dc:creator>
		<pubDate>Fri, 21 Aug 2009 00:27:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-67</guid>
		<description>Let me start by saying that I don&#039;t agree, at all, with you :)

&quot;The truth is if you have to comment your code so you will understand it in the future (...)&quot;
The comments are not there for you to &quot;understand them in the future&quot;, the comments are there for you to know what the code is supposed to do in case you forget.

&quot;You as a developer should be able to write simple and clear code, you should be able to communicate with fellow developers throw your code.&quot;
Just because someone comments their code doesn&#039;t mean their code is complicated and unclear. Most people can read my code, I try to make it clear as possible (that&#039;s why I rewrite a lot of stuff), still, I comment my code a lot. But that&#039;s just how I am. I like to keep things tidy and explain what I&#039;m doing for me when I get back to that code in the future and can&#039;t remember what I wrote or for someone else that happens to have my code (open-source stuff).

&quot;Just imagine you are talking with some one and he has to explain you every sentence! This is what you are doing by over commenting your code!&quot;
I&#039;m sorry but that&#039;s a stupid analogy. If you are talking to somebody and he doesn&#039;t get anything you say, maybe the subject is not of much interest to that person but assuming it is, maybe that person is just plain dumb. If you were thinking out loud and typing your code development with someone next to you, they would probably follow you just fine (as in talking to someone and that someone understands you). But if you just give some piece of code to someone, it will be much easier to understand the code if it&#039;s commented than comment that is not. It doesn&#039;t matter if you&#039;re smart or write clear code, you&#039;re the one who wrote it, you&#039;re the one who knows the code like the back of his hand, not the person who you gave the code to. That person will need to review it and understand it and that, is so much easier if the code is properly commented.

The way I see it, you&#039;re just being lazy. But hey, to each its own.</description>
		<content:encoded><![CDATA[<p>Let me start by saying that I don&#8217;t agree, at all, with you <img src='http://www.francodacosta.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8220;The truth is if you have to comment your code so you will understand it in the future (&#8230;)&#8221;<br />
The comments are not there for you to &#8220;understand them in the future&#8221;, the comments are there for you to know what the code is supposed to do in case you forget.</p>
<p>&#8220;You as a developer should be able to write simple and clear code, you should be able to communicate with fellow developers throw your code.&#8221;<br />
Just because someone comments their code doesn&#8217;t mean their code is complicated and unclear. Most people can read my code, I try to make it clear as possible (that&#8217;s why I rewrite a lot of stuff), still, I comment my code a lot. But that&#8217;s just how I am. I like to keep things tidy and explain what I&#8217;m doing for me when I get back to that code in the future and can&#8217;t remember what I wrote or for someone else that happens to have my code (open-source stuff).</p>
<p>&#8220;Just imagine you are talking with some one and he has to explain you every sentence! This is what you are doing by over commenting your code!&#8221;<br />
I&#8217;m sorry but that&#8217;s a stupid analogy. If you are talking to somebody and he doesn&#8217;t get anything you say, maybe the subject is not of much interest to that person but assuming it is, maybe that person is just plain dumb. If you were thinking out loud and typing your code development with someone next to you, they would probably follow you just fine (as in talking to someone and that someone understands you). But if you just give some piece of code to someone, it will be much easier to understand the code if it&#8217;s commented than comment that is not. It doesn&#8217;t matter if you&#8217;re smart or write clear code, you&#8217;re the one who wrote it, you&#8217;re the one who knows the code like the back of his hand, not the person who you gave the code to. That person will need to review it and understand it and that, is so much easier if the code is properly commented.</p>
<p>The way I see it, you&#8217;re just being lazy. But hey, to each its own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: triton</title>
		<link>http://www.francodacosta.com/development/dont-comment-your-code/comment-page-1#comment-62</link>
		<dc:creator>triton</dc:creator>
		<pubDate>Thu, 20 Aug 2009 16:17:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.francodacosta.com/blog/?p=470#comment-62</guid>
		<description>This is very true.

As you greatly put it: &quot;explain the general purpose of that code block!&quot;.</description>
		<content:encoded><![CDATA[<p>This is very true.</p>
<p>As you greatly put it: &#8220;explain the general purpose of that code block!&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

