<?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: Making comments less necessary</title>
	<atom:link href="http://blog.excastle.com/2008/02/10/making-comments-less-necessary/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/</link>
	<description>Life, .NET, and Cats</description>
	<lastBuildDate>Wed, 10 Mar 2010 13:53:57 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Fernando Madruga</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5879</link>
		<dc:creator>Fernando Madruga</dc:creator>
		<pubDate>Thu, 14 Feb 2008 11:41:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5879</guid>
		<description>There are several uses for comments even if you split your code/functions and name them and the variables &quot;properly&quot;:

1) ///&lt;summary&gt;Insert your function description here...&lt;/summary&gt; before a function that Delphi picks up and shows you when you&#039;re typing that function elsewhere;

2) { TODO : Something } that, again, Delphi picks up and lists in the ToDo list.

3) Documenting some hack: we all know we *shouldn&#039;t* use them, but sometimes they get the job done JIT. Ideally couple that with a ToDo comment to rewrite that hack into clearer code later...

That&#039;s pretty much everything I use comments for: when I opted for pascal vs. C++, I already was willing to type meaningful names. Heck, in my coding style, I rarely, if ever, use an IF *WITHOUT* using a begin/end pair and that&#039;s even it it just has one instruction! I find it easier to visualize that there&#039;s something there that will only be executed SOME times because I also couple that with proper indentation...</description>
		<content:encoded><![CDATA[<p>There are several uses for comments even if you split your code/functions and name them and the variables &#8220;properly&#8221;:</p>
<p>1) ///&lt;summary&gt;Insert your function description here&#8230;&lt;/summary&gt; before a function that Delphi picks up and shows you when you&#8217;re typing that function elsewhere;</p>
<p>2) { TODO : Something } that, again, Delphi picks up and lists in the ToDo list.</p>
<p>3) Documenting some hack: we all know we *shouldn&#8217;t* use them, but sometimes they get the job done JIT. Ideally couple that with a ToDo comment to rewrite that hack into clearer code later&#8230;</p>
<p>That&#8217;s pretty much everything I use comments for: when I opted for pascal vs. C++, I already was willing to type meaningful names. Heck, in my coding style, I rarely, if ever, use an IF *WITHOUT* using a begin/end pair and that&#8217;s even it it just has one instruction! I find it easier to visualize that there&#8217;s something there that will only be executed SOME times because I also couple that with proper indentation&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe White&#8217;s Blog &#187; Blog Archive &#187; If it&#8217;s important enough to comment, it&#8217;s important enough to test</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5868</link>
		<dc:creator>Joe White&#8217;s Blog &#187; Blog Archive &#187; If it&#8217;s important enough to comment, it&#8217;s important enough to test</dc:creator>
		<pubDate>Thu, 14 Feb 2008 06:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5868</guid>
		<description>[...] people disagreed when I said you should try to write code that doesn&#8217;t need comments. I&#8217;ll be addressing [...]</description>
		<content:encoded><![CDATA[<p>[...] people disagreed when I said you should try to write code that doesn&#8217;t need comments. I&#8217;ll be addressing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe White&#8217;s Blog &#187; Blog Archive &#187; Making comments less necessary, part 2</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5838</link>
		<dc:creator>Joe White&#8217;s Blog &#187; Blog Archive &#187; Making comments less necessary, part 2</dc:creator>
		<pubDate>Tue, 12 Feb 2008 14:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5838</guid>
		<description>[...] down methods into smaller pieces, extracting classes, and naming things well.  When I posted about making comments less necessary, I figured there would be a lot of people who could benefit from that same knowledge, and tips on [...]</description>
		<content:encoded><![CDATA[<p>[...] down methods into smaller pieces, extracting classes, and naming things well.  When I posted about making comments less necessary, I figured there would be a lot of people who could benefit from that same knowledge, and tips on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Tesla</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5827</link>
		<dc:creator>Samuel Tesla</dc:creator>
		<pubDate>Tue, 12 Feb 2008 00:25:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5827</guid>
		<description>I agree with the practice of writing self-documenting code, but that only works so much. I&#039;d challenge the &lt;em&gt;best&lt;/em&gt; programmer to write self-documenting assembler. My amount of comments in C or assembler is drastically higher than my amount of comments in Ruby or OCaml.

My policy is to comment the reasons why I made decisions, not what the decisions are, but only if those reasons aren&#039;t obvious. I don&#039;t generally comment &lt;code&gt;free(foo)&lt;/code&gt;, but I might if it&#039;s not the usual usage. I try to simply comment my tricky code. Since I&#039;m not writing code for teaching students, I trust that my reader has a basic fluency in both general programming and the language I&#039;m using. If I&#039;m (ab)using an advanced language feature, then I&#039;ll comment.

With my policy, comments are almost never stale, always helpful, and far and few between.</description>
		<content:encoded><![CDATA[<p>I agree with the practice of writing self-documenting code, but that only works so much. I&#8217;d challenge the <em>best</em> programmer to write self-documenting assembler. My amount of comments in C or assembler is drastically higher than my amount of comments in Ruby or OCaml.</p>
<p>My policy is to comment the reasons why I made decisions, not what the decisions are, but only if those reasons aren&#8217;t obvious. I don&#8217;t generally comment <code>free(foo)</code>, but I might if it&#8217;s not the usual usage. I try to simply comment my tricky code. Since I&#8217;m not writing code for teaching students, I trust that my reader has a basic fluency in both general programming and the language I&#8217;m using. If I&#8217;m (ab)using an advanced language feature, then I&#8217;ll comment.</p>
<p>With my policy, comments are almost never stale, always helpful, and far and few between.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5819</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 11 Feb 2008 18:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5819</guid>
		<description>&quot;Generally speaking, I tend to try to write code which is self-documenting in terms of what it does, and use comments to indicate why it does what it does.&quot;

That is the best advice here.</description>
		<content:encoded><![CDATA[<p>&#8220;Generally speaking, I tend to try to write code which is self-documenting in terms of what it does, and use comments to indicate why it does what it does.&#8221;</p>
<p>That is the best advice here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5817</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Mon, 11 Feb 2008 17:55:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5817</guid>
		<description>Generally speaking, I tend to try to write code which is self-documenting in terms of &lt;i&gt;what&lt;/i&gt; it does, and use comments to indicate &lt;i&gt;why&lt;/i&gt; it does what it does.</description>
		<content:encoded><![CDATA[<p>Generally speaking, I tend to try to write code which is self-documenting in terms of <i>what</i> it does, and use comments to indicate <i>why</i> it does what it does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Fosdal</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5811</link>
		<dc:creator>Lars Fosdal</dc:creator>
		<pubDate>Mon, 11 Feb 2008 09:03:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5811</guid>
		<description>Descriptive method, variable and type names gets you a long way, but some times it is very useful to add a few comments that describe the goal of the code in question, clarify key events or decision points in a method, overall structure of a complex data model, or - in case variables are not self-explanatory - a little information about what you intend to store in the variable(s).

I try to avoid directly re-describing the algorithm, but instead try explain my goal.  This puts some context around my sparsely commented code, and usually don&#039;t get outdated by changes to the code. For primitives, it is important to comment the requirements for the in-data - at least if you don&#039;t enforce those requirements with Asserts.

The &quot;Real programmers don&#039;t write comments - It was hard to write, it should be hard to read&quot; model is passé.  If the developer is to lazy to maintain his commentary, he probably writes sloppy code in the first place.</description>
		<content:encoded><![CDATA[<p>Descriptive method, variable and type names gets you a long way, but some times it is very useful to add a few comments that describe the goal of the code in question, clarify key events or decision points in a method, overall structure of a complex data model, or &#8211; in case variables are not self-explanatory &#8211; a little information about what you intend to store in the variable(s).</p>
<p>I try to avoid directly re-describing the algorithm, but instead try explain my goal.  This puts some context around my sparsely commented code, and usually don&#8217;t get outdated by changes to the code. For primitives, it is important to comment the requirements for the in-data &#8211; at least if you don&#8217;t enforce those requirements with Asserts.</p>
<p>The &#8220;Real programmers don&#8217;t write comments &#8211; It was hard to write, it should be hard to read&#8221; model is passé.  If the developer is to lazy to maintain his commentary, he probably writes sloppy code in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew V.</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5809</link>
		<dc:creator>Andrew V.</dc:creator>
		<pubDate>Mon, 11 Feb 2008 03:25:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5809</guid>
		<description>In essence I agree, most commenting is pretty useless and seems to be done just because the programmer was told they need to put in some comments.   But the comments I care most about are not the one&#039;s that could easily be gotten rid of with some intelligent variable and function naming (like the standard &quot;this procedure does this&quot; function header).  The one&#039;s that most concern me and that are most critical to me are those that describe changes made to work around an issue or fix a bug, particularly those that need to be made clear for the programmer coming afterwards (whether that&#039;s me or someone after me).  The second set of important comments are those noting what has been changed and why, when these changes are made to code in areas of a high level of concern.</description>
		<content:encoded><![CDATA[<p>In essence I agree, most commenting is pretty useless and seems to be done just because the programmer was told they need to put in some comments.   But the comments I care most about are not the one&#8217;s that could easily be gotten rid of with some intelligent variable and function naming (like the standard &#8220;this procedure does this&#8221; function header).  The one&#8217;s that most concern me and that are most critical to me are those that describe changes made to work around an issue or fix a bug, particularly those that need to be made clear for the programmer coming afterwards (whether that&#8217;s me or someone after me).  The second set of important comments are those noting what has been changed and why, when these changes are made to code in areas of a high level of concern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars D</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5807</link>
		<dc:creator>Lars D</dc:creator>
		<pubDate>Sun, 10 Feb 2008 22:13:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5807</guid>
		<description>Sorry, but I never saw real-life code, that all programmers can understand quickly... :-)</description>
		<content:encoded><![CDATA[<p>Sorry, but I never saw real-life code, that all programmers can understand quickly&#8230; <img src='http://blog.excastle.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Mueller</title>
		<link>http://blog.excastle.com/2008/02/10/making-comments-less-necessary/comment-page-1/#comment-5806</link>
		<dc:creator>Thomas Mueller</dc:creator>
		<pubDate>Sun, 10 Feb 2008 21:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2008/02/10/making-comments-less-necessary/#comment-5806</guid>
		<description>I 100% agree: There are very few cases when a comment is necessary. Every time I start writing a comment I stop to think whether it might not be a better idea to change the code in a way that makes it self explanatory, e.g. change the name of a function or parameter, change the type of a parameter e.g. from integer to an enum, refactor code to use &quot;speaking&quot; variable names for storing a part-result rather than having an unreadable monster formula etc. It is usually a better investment of the time to do this rather than writing a comment.

As you say - and as I have seen happening frequently - comments go stale because when changing the code very rarely the comments are adapted. And a wrong comment is even worse than none at all.</description>
		<content:encoded><![CDATA[<p>I 100% agree: There are very few cases when a comment is necessary. Every time I start writing a comment I stop to think whether it might not be a better idea to change the code in a way that makes it self explanatory, e.g. change the name of a function or parameter, change the type of a parameter e.g. from integer to an enum, refactor code to use &#8220;speaking&#8221; variable names for storing a part-result rather than having an unreadable monster formula etc. It is usually a better investment of the time to do this rather than writing a comment.</p>
<p>As you say &#8211; and as I have seen happening frequently &#8211; comments go stale because when changing the code very rarely the comments are adapted. And a wrong comment is even worse than none at all.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
