<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Floehopper: Tag comment</title>
    <link>http://blog.floehopper.org/articles/tag/comment?tag=comment</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts on the bergy bits of life</description>
    <item>
      <title>Prefer Commit Notes over Comments</title>
      <description>&lt;p&gt;My colleague, &lt;a href="http://blog.seagul.co.uk/"&gt;Chris&lt;/a&gt;, recently posted about &lt;a href="http://blog.seagul.co.uk/articles/2008/03/28/version-control-commit-note-best-practice-or-not-you-decide"&gt;what makes a good commit note&lt;/a&gt;. His main point is that a good commit note should explain &lt;strong&gt;why&lt;/strong&gt; the changeset exists rather than &lt;strong&gt;what&lt;/strong&gt; it contains (which should be more self-evident). I agree with this and (as Chris mentions) it&amp;#8217;s of particular benefit when you have to do some software archeology. I&amp;#8217;d go a step further and say that, for me, the best commit notes express the &lt;em&gt;business&lt;/em&gt; reason for the changeset. If as a developer you are struggling to explain the business case for a particular change, (imho) you should try to find out before committing &amp;#8211; otherwise how do you know the changeset is delivering value to the business?&lt;/p&gt;


	&lt;p&gt;In a previous post about &lt;a href="http://blog.floehopper.org/articles/2007/05/10/prefer-tests-over-comments"&gt;preferring tests over comments&lt;/a&gt;, I expressed similar sentiments about using comments and tests to explain &lt;strong&gt;why&lt;/strong&gt; rather than &lt;strong&gt;what&lt;/strong&gt;. Chris&amp;#8217; post prompted me to re-read that old post and I noticed that it didn&amp;#8217;t explain why I &lt;a href="http://blog.floehopper.org/articles/2007/05/10/prefer-tests-over-comments"&gt;prefer tests over comments&lt;/a&gt;. The reason is that comments have a nasty habit of becoming out-of-date and getting left lying around to confuse the unwary, whereas you are forced to keep tests up-to-date (assuming they are part of a &lt;a href="http://martinfowler.com/articles/continuousIntegration.html"&gt;continuous integration build&lt;/a&gt;). For similar reasons I also think that commit notes are better than code comments, because they are forever associated with a snapshot of the code at the time they were written &amp;#8211; leaving less scope for confusion.&lt;/p&gt;</description>
      <pubDate>Sat, 29 Mar 2008 19:05:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:11955d9f-4314-46f7-b708-dca8b3860930</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2008/03/29/prefer-commit-notes-over-comments</link>
      <category>version</category>
      <category>control</category>
      <category>commit</category>
      <category>note</category>
      <category>changeset</category>
      <category>svn</category>
      <category>vcs</category>
      <category>comment</category>
      <category>why</category>
      <category>what</category>
    </item>
    <item>
      <title>Prefer Tests Over Comments</title>
      <description>&lt;p&gt;One small a-ha moment in my early programming days was when someone suggested it was better to write a comment explaining why a chunk of code worked the way it did, rather than simply describing how it worked &amp;#8211; essentially a direct translation of the code into english sentences.&lt;/p&gt;


	&lt;p&gt;Since then I&amp;#8217;ve become a &lt;a href="http://junit.sourceforge.net/doc/testinfected/testing.htm"&gt;test-infected&lt;/a&gt;, &lt;a href="http://www.amazon.co.uk/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530"&gt;test-driven&lt;/a&gt; developer and now I would always choose to write a test in preference to writing a comment. But I think the same lesson still applies&amp;#8230;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve recently been making a conscious effort to come up with better test names. The easy option is for the test name to reflect what happens in the test. But it makes the test much more valuable if you can use the test name to explain why the behaviour is the way it is.&lt;/p&gt;


	&lt;p&gt;Comments are also often used as to-do items, but I think tests can be a better solution. For example, Ben mentions &lt;a href="http://www.reevoo.com/blogs/bengriffiths/2007/02/14/leaving-notes-for-the-team-in-tests/"&gt;leaving notes for the team in tests&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Thu, 10 May 2007 15:29:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9c484bf4-6cae-45d2-9ab5-c64a5bd156e0</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2007/05/10/prefer-tests-over-comments</link>
      <category>test</category>
      <category>comment</category>
      <category>todo</category>
      <category>intent</category>
    </item>
  </channel>
</rss>
