<?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: The Golden Rule of Unit Testing</title> <atom:link href="http://hackerboss.com/the-golden-rule-of-unit-testing/feed/" rel="self" type="application/rss+xml" /><link>http://hackerboss.com/the-golden-rule-of-unit-testing/</link> <description>Developing software and managing development teams.</description> <lastBuildDate>Sun, 08 Aug 2010 20:15:47 +0000</lastBuildDate> <generator>http://wordpress.org/?v=</generator> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>By: Brian Lavender</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-31</link> <dc:creator>Brian Lavender</dc:creator> <pubDate>Thu, 14 May 2009 09:38:16 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-31</guid> <description>I have to apologize. I was being sort of esoteric. When you mentioned sml, it made me think of my programming principles class at Sac State, where we used Bertrand Meyer&#039;s book &quot;Introduction to the Theory of Programming Languages&quot;. which in turn made me think of his language Eiffel and Design by Contract. Honestly, I haven&#039;t used DbC much in practice, so I can&#039;t speak from real experience. I know that DbC is now in Java, .net, and a number of other areas.Certainly, you make a good point with unit testing.</description> <content:encoded><![CDATA[<p>I have to apologize. I was being sort of esoteric. When you mentioned sml, it made me think of my programming principles class at Sac State, where we used Bertrand Meyer&#8217;s book &#8220;Introduction to the Theory of Programming Languages&#8221;. which in turn made me think of his language Eiffel and Design by Contract. Honestly, I haven&#8217;t used DbC much in practice, so I can&#8217;t speak from real experience. I know that DbC is now in Java, .net, and a number of other areas.</p><p>Certainly, you make a good point with unit testing.</p> ]]></content:encoded> </item> <item><title>By: Ville Laurikari</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-29</link> <dc:creator>Ville Laurikari</dc:creator> <pubDate>Wed, 13 May 2009 17:56:24 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-29</guid> <description>I certainly use asserts and other similar tools to check invariants at run time, but I&#039;ve never followed the DbC dogma to the point of writing the contracts before writing the code; this may be just because I haven&#039;t used Eiffel.  But I have written unit tests before writing the implementation(s), which is kind of the same thing but with a different twist.As for proving correctness... I&#039;m not a believer, at least not for widespread use in &quot;everyday programming&quot; by the masses.  Then again, I also believe that the masses should not be writing computer programs in the first place.</description> <content:encoded><![CDATA[<p>I certainly use asserts and other similar tools to check invariants at run time, but I&#8217;ve never followed the DbC dogma to the point of writing the contracts before writing the code; this may be just because I haven&#8217;t used Eiffel.  But I have written unit tests before writing the implementation(s), which is kind of the same thing but with a different twist.</p><p>As for proving correctness&#8230; I&#8217;m not a believer, at least not for widespread use in &#8220;everyday programming&#8221; by the masses.  Then again, I also believe that the masses should not be writing computer programs in the first place.</p> ]]></content:encoded> </item> <item><title>By: Brian Lavender</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-27</link> <dc:creator>Brian Lavender</dc:creator> <pubDate>Wed, 13 May 2009 08:15:00 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-27</guid> <description>What about pre, post, and invariant conditions like in Eiffel? Seems that design by contract can build a lot of confidence into the code. I have only briefly played with it, but assuming your code is not influenced or produces side effects, you can prove it correct. I don&#039;t have a lot of experience with it, but I thought I would throw that out there.brian</description> <content:encoded><![CDATA[<p>What about pre, post, and invariant conditions like in Eiffel? Seems that design by contract can build a lot of confidence into the code. I have only briefly played with it, but assuming your code is not influenced or produces side effects, you can prove it correct. I don&#8217;t have a lot of experience with it, but I thought I would throw that out there.</p><p>brian</p> ]]></content:encoded> </item> <item><title>By: klaar</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-202</link> <dc:creator>klaar</dc:creator> <pubDate>Tue, 12 May 2009 20:31:41 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-202</guid> <description>&lt;p&gt;Does he mean that i should optimize my test coverage to only cover the most important components at an early stage? Very clever.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09itnb&quot; rel=&quot;nofollow&quot;&gt;Reddit&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description> <content:encoded><![CDATA[<p>Does he mean that i should optimize my test coverage to only cover the most important components at an early stage? Very clever.</p><p><i>This comment was originally posted on <a
href="http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09itnb" rel="nofollow">Reddit</a></i></p> ]]></content:encoded> </item> <item><title>By: Ville Laurikari</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-25</link> <dc:creator>Ville Laurikari</dc:creator> <pubDate>Tue, 12 May 2009 17:30:49 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-25</guid> <description>Justice, I completely agree.  What prompted me to write this post was the common misunderstanding that a &quot;unit test&quot; is supposed to test the smallest possible unit (a function or method) in isolation.  If it&#039;s testing more than that, it&#039;s not a &quot;unit test&quot; but something else.In my world, a &quot;unit test&quot; is almost always testing the public interface.  This appears to also be the viewpoint of the software industry in general, but every now and then I run into trouble with this terminology.So, before one goes very deep into an argument about &quot;unit testing&quot; with someone, it may be useful to check if you&#039;re even talking about the same things...</description> <content:encoded><![CDATA[<p>Justice, I completely agree.  What prompted me to write this post was the common misunderstanding that a &#8220;unit test&#8221; is supposed to test the smallest possible unit (a function or method) in isolation.  If it&#8217;s testing more than that, it&#8217;s not a &#8220;unit test&#8221; but something else.</p><p>In my world, a &#8220;unit test&#8221; is almost always testing the public interface.  This appears to also be the viewpoint of the software industry in general, but every now and then I run into trouble with this terminology.</p><p>So, before one goes very deep into an argument about &#8220;unit testing&#8221; with someone, it may be useful to check if you&#8217;re even talking about the same things&#8230;</p> ]]></content:encoded> </item> <item><title>By: Justice</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-24</link> <dc:creator>Justice</dc:creator> <pubDate>Tue, 12 May 2009 17:15:24 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-24</guid> <description>It&#039;s a long way of saying: write unit tests public interfaces and contractual behaviors; don&#039;t write unit tests for private implementation details or for simple getters and setters.Harry should have written a few unit tests for the module&#039;s public interface (the single function &#039;parse&#039;), testing various scenarios ranging from simple to complex. He should not have written unit tests for the particular way he implemented the interface. When he added in behavior to handle newlines, he should have written some unit tests to check that the newlines bug does not will not reappear later as a regression. When Ethan ripped out the regexes and replaced them with a parser, he should have written some tests specifying that the module can handle character-entities too, thus protecting against a future reappearance as a regression of the character-entities bug.Of course, while developing a module, one may want to include some test-driver code to check basic parts of the implementation. But these test-drivers are not part of the unit-test suite. They should not be run automatically. They are there only to ease development, and may be deleted at will (because you are using source control, right?).Unit tests are a way of answering, in precise a way as you are willing to write code for, the question: &quot;What is this public interface supposed to be doing, and does it actually do that?&quot; Unit tests should not answer the question: &quot;How does this implementation work under the hood?&quot;</description> <content:encoded><![CDATA[<p>It&#8217;s a long way of saying: write unit tests public interfaces and contractual behaviors; don&#8217;t write unit tests for private implementation details or for simple getters and setters.</p><p>Harry should have written a few unit tests for the module&#8217;s public interface (the single function &#8216;parse&#8217;), testing various scenarios ranging from simple to complex. He should not have written unit tests for the particular way he implemented the interface. When he added in behavior to handle newlines, he should have written some unit tests to check that the newlines bug does not will not reappear later as a regression. When Ethan ripped out the regexes and replaced them with a parser, he should have written some tests specifying that the module can handle character-entities too, thus protecting against a future reappearance as a regression of the character-entities bug.</p><p>Of course, while developing a module, one may want to include some test-driver code to check basic parts of the implementation. But these test-drivers are not part of the unit-test suite. They should not be run automatically. They are there only to ease development, and may be deleted at will (because you are using source control, right?).</p><p>Unit tests are a way of answering, in precise a way as you are willing to write code for, the question: &#8220;What is this public interface supposed to be doing, and does it actually do that?&#8221; Unit tests should not answer the question: &#8220;How does this implementation work under the hood?&#8221;</p> ]]></content:encoded> </item> <item><title>By: vlaurika</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-204</link> <dc:creator>vlaurika</dc:creator> <pubDate>Tue, 12 May 2009 15:13:30 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-204</guid> <description>&lt;p&gt;&gt; What he is describing is making your new code legacy before it is even released because there are many dependencies from test cases. The point is that you should aim to get your test coverage by testing on a level which is the least likely to lead to a lot of obsolete test code after a potential future refactoring. That kind of test code is *helpful* when refactoring, instead of merely obsolete. Testing each function in perfect isolation, as per the Wikipedia definition of unit testing, does not help you when you refactor the code.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09iiem&quot; rel=&quot;nofollow&quot;&gt;Reddit&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description> <content:encoded><![CDATA[<p>&gt; What he is describing is making your new code legacy before it is even released because there are many dependencies from test cases. The point is that you should aim to get your test coverage by testing on a level which is the least likely to lead to a lot of obsolete test code after a potential future refactoring. That kind of test code is *helpful* when refactoring, instead of merely obsolete. Testing each function in perfect isolation, as per the Wikipedia definition of unit testing, does not help you when you refactor the code.</p><p><i>This comment was originally posted on <a
href="http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09iiem" rel="nofollow">Reddit</a></i></p> ]]></content:encoded> </item> <item><title>By: gregK</title><link>http://hackerboss.com/the-golden-rule-of-unit-testing/comment-page-1/#comment-205</link> <dc:creator>gregK</dc:creator> <pubDate>Tue, 12 May 2009 15:01:06 +0000</pubDate> <guid
isPermaLink="false">http://laurikari.net/ville/?p=71#comment-205</guid> <description>&lt;p&gt;&gt;Most importantly, unit tests make the code rigid. It makes little sense to write heaps of testing code against interfaces which will be changed soon. He bring out an important point. If you are afraid to fix your code because you don&#8217;t want to rewrite your unit tests then something went terribly wrong. What he is describing is making your new code legacy before it is even released because there are many dependencies from test cases. I say don&#8217;t be afraid to scrap obsolete test cases. Also I agree don&#8217;t over do it, if you are still figuring out what you want. Get your ideas straight first then focus on robustness via massive tests.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09ii07&quot; rel=&quot;nofollow&quot;&gt;Reddit&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description> <content:encoded><![CDATA[<p>&gt;Most importantly, unit tests make the code rigid. It makes little sense to write heaps of testing code against interfaces which will be changed soon. He bring out an important point. If you are afraid to fix your code because you don&#8217;t want to rewrite your unit tests then something went terribly wrong. What he is describing is making your new code legacy before it is even released because there are many dependencies from test cases. I say don&#8217;t be afraid to scrap obsolete test cases. Also I agree don&#8217;t over do it, if you are still figuring out what you want. Get your ideas straight first then focus on robustness via massive tests.</p><p><i>This comment was originally posted on <a
href="http://www.reddit.com/r/programming/comments/8jtu8/the_golden_rule_of_unit_testing/c09ii07" rel="nofollow">Reddit</a></i></p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching using disk

Served from: hackerboss.com @ 2010-09-05 20:25:17 -->