<?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: A response to the SWE101 attendees who tried to solve the TDD problem without TDD</title>
	<atom:link href="http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/</link>
	<description></description>
	<pubDate>Fri, 18 May 2012 01:21:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tracy Harms</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4875</link>
		<dc:creator>Tracy Harms</dc:creator>
		<pubDate>Thu, 04 Mar 2010 15:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4875</guid>
		<description>Yesterday I had an interesting conversation with my son, a Java coder, over this blog. We compared the programs of JK and LEG(G), above. He found Jon's program far easier to read, and hearing him comment from his perspective helped me appreciate what he likes about it. The most obvious thing was how JK's code fit his sense of normalcy, knowing Java but not C#. In contrast, LEG(G)'s code seemed impenetrable given his lack of C# knowledge. I, too, am ignorant of C#, but from my perspective as a J coder I was more comfortable with what LEG(G) had written.

Out of this I've gained the impression that TDD is a technique intended to favor a particular style of coding. In the past I've heard TDD promoted as a technique that makes it easier to write "better" code, but without containing claims as to what counts as "better." Now I'm thinking TDD (as we know it) is being advocated by people who have particular preferences, and that what TDD helps most is implementing according to these preferences.

If this is so, what does it imply for languages that don't fit the preferred style? If this is not the case, how would we criticize this notion to identify the error?</description>
		<content:encoded><![CDATA[<p>Yesterday I had an interesting conversation with my son, a Java coder, over this blog. We compared the programs of JK and LEG(G), above. He found Jon&#8217;s program far easier to read, and hearing him comment from his perspective helped me appreciate what he likes about it. The most obvious thing was how JK&#8217;s code fit his sense of normalcy, knowing Java but not C#. In contrast, LEG(G)&#8217;s code seemed impenetrable given his lack of C# knowledge. I, too, am ignorant of C#, but from my perspective as a J coder I was more comfortable with what LEG(G) had written.</p>
<p>Out of this I&#8217;ve gained the impression that TDD is a technique intended to favor a particular style of coding. In the past I&#8217;ve heard TDD promoted as a technique that makes it easier to write &#8220;better&#8221; code, but without containing claims as to what counts as &#8220;better.&#8221; Now I&#8217;m thinking TDD (as we know it) is being advocated by people who have particular preferences, and that what TDD helps most is implementing according to these preferences.</p>
<p>If this is so, what does it imply for languages that don&#8217;t fit the preferred style? If this is not the case, how would we criticize this notion to identify the error?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Evaristo Guerche (Gorše)</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4874</link>
		<dc:creator>Luciano Evaristo Guerche (Gorše)</dc:creator>
		<pubDate>Wed, 03 Mar 2010 14:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4874</guid>
		<description>In case no one else noted there might be only seven weights (max number of faces + the zero index), so I changed private members to:

private static int[] setWeights = new int[] { 0, 1000, 200, 300, 400, 500, 600 };
private static int[] diceWeights = new int[] { 0, 100, 0, 0, 0, 50, 0 };</description>
		<content:encoded><![CDATA[<p>In case no one else noted there might be only seven weights (max number of faces + the zero index), so I changed private members to:</p>
<p>private static int[] setWeights = new int[] { 0, 1000, 200, 300, 400, 500, 600 };<br />
private static int[] diceWeights = new int[] { 0, 100, 0, 0, 0, 50, 0 };</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Evaristo Guerche (Gorše)</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4873</link>
		<dc:creator>Luciano Evaristo Guerche (Gorše)</dc:creator>
		<pubDate>Wed, 03 Mar 2010 14:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4873</guid>
		<description>Code in the comments seems ugly, so I posted it to http://codepaste.net/srcjuh also. I also sending below the code metrics Visual Studio Team System generates about this new implementation.

Member: Score(int[]) : int
Maintainability Index: 63
Cyclomatic Complexity: 9
Class Coupling: 3
Lines of Code: 6</description>
		<content:encoded><![CDATA[<p>Code in the comments seems ugly, so I posted it to <a href="http://codepaste.net/srcjuh" rel="nofollow">http://codepaste.net/srcjuh</a> also. I also sending below the code metrics Visual Studio Team System generates about this new implementation.</p>
<p>Member: Score(int[]) : int<br />
Maintainability Index: 63<br />
Cyclomatic Complexity: 9<br />
Class Coupling: 3<br />
Lines of Code: 6</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Evaristo Guerche (Gorše)</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4872</link>
		<dc:creator>Luciano Evaristo Guerche (Gorše)</dc:creator>
		<pubDate>Wed, 03 Mar 2010 13:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4872</guid>
		<description>@Andy,

The written requirements mentioned "sets of three X dice faces..." not "occurrences of X dice face". Based on that I supposed items should be contiguous to be counted as a set. If I had supposed they didn't need to be contiguous I'd have devised the following implementation instead:

        private static int[] setWeights = new int[] { 0, 1000, 200, 300, 400, 500, 600, 700, 800, 900 };
        private static int[] diceWeights = new int[] { 0, 100, 0, 0, 0, 50, 0, 0, 0, 0 };

        static int Score(int[] diceValues)
        {
            return (
                    (
                     from item in diceValues
                     group item by item into dice
                     orderby dice.Key
                     select new
                     {
                         Dice = dice.Key,
                         Score = (dice.Count() / 3 * setWeights[dice.Key]) +
                                 (dice.Count() % 3 * diceWeights[dice.Key])
                     }
                    ).Sum(item =&#62; item.Score)
                   );
        }</description>
		<content:encoded><![CDATA[<p>@Andy,</p>
<p>The written requirements mentioned &#8220;sets of three X dice faces&#8230;&#8221; not &#8220;occurrences of X dice face&#8221;. Based on that I supposed items should be contiguous to be counted as a set. If I had supposed they didn&#8217;t need to be contiguous I&#8217;d have devised the following implementation instead:</p>
<p>        private static int[] setWeights = new int[] { 0, 1000, 200, 300, 400, 500, 600, 700, 800, 900 };<br />
        private static int[] diceWeights = new int[] { 0, 100, 0, 0, 0, 50, 0, 0, 0, 0 };</p>
<p>        static int Score(int[] diceValues)<br />
        {<br />
            return (<br />
                    (<br />
                     from item in diceValues<br />
                     group item by item into dice<br />
                     orderby dice.Key<br />
                     select new<br />
                     {<br />
                         Dice = dice.Key,<br />
                         Score = (dice.Count() / 3 * setWeights[dice.Key]) +<br />
                                 (dice.Count() % 3 * diceWeights[dice.Key])<br />
                     }<br />
                    ).Sum(item =&gt; item.Score)<br />
                   );<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Kruger</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4869</link>
		<dc:creator>Jon Kruger</dc:creator>
		<pubDate>Tue, 02 Mar 2010 21:49:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4869</guid>
		<description>@Luciano, 

I think readability and maintainability are very important, and they aren't necessarily measured by metrics.  If by adding some extra if statements and methods I can make my code easier to read, then I think that's a good thing.  Let's say that we added more rules to the Greed game, and someone other than you and I had to modify the code we had written (this happens all the time in real life).  How hard would it be for that person to get the job done?

Like you said, your code probably is faster, but in this case, performance wasn't really a consideration.  Certainly if it were an issue, I might have to refactor something.  But I'm guessing that the difference in performance is negligible anyway.

Again, the goal of the TDD session was not to see how fast we could solve the problem.  We could've gone faster if we weren't trying to demonstrate how to do TDD (which was the main goal of the whole thing).</description>
		<content:encoded><![CDATA[<p>@Luciano, </p>
<p>I think readability and maintainability are very important, and they aren&#8217;t necessarily measured by metrics.  If by adding some extra if statements and methods I can make my code easier to read, then I think that&#8217;s a good thing.  Let&#8217;s say that we added more rules to the Greed game, and someone other than you and I had to modify the code we had written (this happens all the time in real life).  How hard would it be for that person to get the job done?</p>
<p>Like you said, your code probably is faster, but in this case, performance wasn&#8217;t really a consideration.  Certainly if it were an issue, I might have to refactor something.  But I&#8217;m guessing that the difference in performance is negligible anyway.</p>
<p>Again, the goal of the TDD session was not to see how fast we could solve the problem.  We could&#8217;ve gone faster if we weren&#8217;t trying to demonstrate how to do TDD (which was the main goal of the whole thing).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Vulhop</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4867</link>
		<dc:creator>Andy Vulhop</dc:creator>
		<pubDate>Tue, 02 Mar 2010 20:59:05 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4867</guid>
		<description>@GuercheLE:
If I open Jon's code, I can read it like text and understand EXACTLY what it's intended to do and pretty clearly how it's being done. I don't mean to be insulting, but your implementation is ugly. It's difficult to read, and, despite what your metric generator told you, has more indentions than Jon's.  That's more telling of the complexity than a metric spit out by a VS tool. Metrics are a rule-of-thumb guideline, at best. At some point, it comes down to using your head. 

The point in this workshop was not speed of implementation or (premature) optimization of the code. It was a learning excercise. You are kidding yourself if you think the people running this workshop couldn't have knocked out that Greed engine in no time with a full suite of unit tests in full TDD fashion. The idea was to take the time to focus on how it is done for the people who don't yet understand how to do TDD on a non-trivial task front-to-back. 

But the most important metric is correctness of implementation. The whole thing is bunk when you come down to the fact that your code isn't correct. By ignoring the testing and just slinging code, you left it open for bugs. What if you send yours {1,5,1,5,1}? You return 400. The correct response is 1100. It's because you assume the sets of 3 are in runs, when they can be separated. 

Don't take it personally. Egoless programming is even more important than TDD. You are not defined by your code. 

@Jon
Can't wait for the recording. I hope to spread it around the office. Finally getting some buy-in on TDD around here, but I think it's at the "but it will be too hard" phase for some.</description>
		<content:encoded><![CDATA[<p>@GuercheLE:<br />
If I open Jon&#8217;s code, I can read it like text and understand EXACTLY what it&#8217;s intended to do and pretty clearly how it&#8217;s being done. I don&#8217;t mean to be insulting, but your implementation is ugly. It&#8217;s difficult to read, and, despite what your metric generator told you, has more indentions than Jon&#8217;s.  That&#8217;s more telling of the complexity than a metric spit out by a VS tool. Metrics are a rule-of-thumb guideline, at best. At some point, it comes down to using your head. </p>
<p>The point in this workshop was not speed of implementation or (premature) optimization of the code. It was a learning excercise. You are kidding yourself if you think the people running this workshop couldn&#8217;t have knocked out that Greed engine in no time with a full suite of unit tests in full TDD fashion. The idea was to take the time to focus on how it is done for the people who don&#8217;t yet understand how to do TDD on a non-trivial task front-to-back. </p>
<p>But the most important metric is correctness of implementation. The whole thing is bunk when you come down to the fact that your code isn&#8217;t correct. By ignoring the testing and just slinging code, you left it open for bugs. What if you send yours {1,5,1,5,1}? You return 400. The correct response is 1100. It&#8217;s because you assume the sets of 3 are in runs, when they can be separated. </p>
<p>Don&#8217;t take it personally. Egoless programming is even more important than TDD. You are not defined by your code. </p>
<p>@Jon<br />
Can&#8217;t wait for the recording. I hope to spread it around the office. Finally getting some buy-in on TDD around here, but I think it&#8217;s at the &#8220;but it will be too hard&#8221; phase for some.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Evaristo Guerche (Gorše)</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4865</link>
		<dc:creator>Luciano Evaristo Guerche (Gorše)</dc:creator>
		<pubDate>Tue, 02 Mar 2010 17:48:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4865</guid>
		<description>Just in case you get the full text response truncated on comments: http://www.google.com/reader/item/tag:google.com,2005:reader/item/4f277f641a373cb1</description>
		<content:encoded><![CDATA[<p>Just in case you get the full text response truncated on comments: <a href="http://www.google.com/reader/item/tag:google.com,2005:reader/item/4f277f641a373cb1" rel="nofollow">http://www.google.com/reader/item/tag:google.com,2005:reader/item/4f277f641a373cb1</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Evaristo Guerche (Gorše)</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4864</link>
		<dc:creator>Luciano Evaristo Guerche (Gorše)</dc:creator>
		<pubDate>Tue, 02 Mar 2010 17:42:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4864</guid>
		<description>Jon,

Please take a look at the following code metrics (static analysis) produced by Visual Studio Team System 2008 Development Edition and compare:

Type: GreedScorer
Maintainability Index: 66
Cyclomatic Complexity: 48
Depth of Inheritance: 1
Class Coupling: 3
Lines of Code: 62

Member: Score(int[]) : int
Maintainability Index: 50
Cyclomatic Complexity: 16
Class Coupling: 0
Lines of Code: 21

Although, your implementation has a maintainability index a bit higher than mine (16 points up), your implementation has a cyclomatic complexity 3x higher than mine (why complain about my fors, switches and ifs, as some of your blog followers did in the comments, when my implementation has a much much lower cyclomatic complexity), your implementation has Depth of Inheritance and Class Coupling, whereas mine does not have. Moreover, you implementation has 3x the lines of code mine has.

I haven't run a dynamic code analysis (profiling/instrumentation) to compare implementations, but just reviewing your code it becomes clear it has performance implications. It iterates through same array so many times, whereas mine iterates through the array items just once.

If I had commented my code, maybe it would be friendlier to some, but come on people, I implemented it in less than 5 minutes. How long did it take you to implement yours? As far as I remember, a whole afternoon. Don't be so rude on me, please.

Your presentation about TDD was great, when looking at the WHAT perspective (how to create the tests, what tests to undergo, etc., etc.), but when it came to the HOW part, it seems you, people, got lost and implemented something not that simple, just to satisfy the requirements your tests carried on. While the #swe101 was live (underway), I asked you, people, to use and adapt my implementation (the HOW perspective), so that to avoid wasting so much time on it and to check my implementation (the HOW part) was conformant to the tests you created (the WHAT perspective), but no one took it into account.

If TDD was to sacrifice performance, increase complexity, depth, coupling and lines of code to write, I wouldn't jump in for sure. Fortunately, it is not, as far as I am concerned about. Just an advice, pay much much more attention to the "WHAT perspective" next time and make things as simple as possible. I may not know much about the WHAT, but I know a lot of the HOW, since I review, refactor, fine tune and try the simplest wherever possible.

I don't want start a war here (we have a lot out there already) and I won't go any further on this. Just needed to come up and defend my code. That's what I do for living for long.

Thanks and regards,

Luciano Evaristo Guerche (Gorše)
Taboão da Serra, SP, Brazil</description>
		<content:encoded><![CDATA[<p>Jon,</p>
<p>Please take a look at the following code metrics (static analysis) produced by Visual Studio Team System 2008 Development Edition and compare:</p>
<p>Type: GreedScorer<br />
Maintainability Index: 66<br />
Cyclomatic Complexity: 48<br />
Depth of Inheritance: 1<br />
Class Coupling: 3<br />
Lines of Code: 62</p>
<p>Member: Score(int[]) : int<br />
Maintainability Index: 50<br />
Cyclomatic Complexity: 16<br />
Class Coupling: 0<br />
Lines of Code: 21</p>
<p>Although, your implementation has a maintainability index a bit higher than mine (16 points up), your implementation has a cyclomatic complexity 3x higher than mine (why complain about my fors, switches and ifs, as some of your blog followers did in the comments, when my implementation has a much much lower cyclomatic complexity), your implementation has Depth of Inheritance and Class Coupling, whereas mine does not have. Moreover, you implementation has 3x the lines of code mine has.</p>
<p>I haven&#8217;t run a dynamic code analysis (profiling/instrumentation) to compare implementations, but just reviewing your code it becomes clear it has performance implications. It iterates through same array so many times, whereas mine iterates through the array items just once.</p>
<p>If I had commented my code, maybe it would be friendlier to some, but come on people, I implemented it in less than 5 minutes. How long did it take you to implement yours? As far as I remember, a whole afternoon. Don&#8217;t be so rude on me, please.</p>
<p>Your presentation about TDD was great, when looking at the WHAT perspective (how to create the tests, what tests to undergo, etc., etc.), but when it came to the HOW part, it seems you, people, got lost and implemented something not that simple, just to satisfy the requirements your tests carried on. While the #swe101 was live (underway), I asked you, people, to use and adapt my implementation (the HOW perspective), so that to avoid wasting so much time on it and to check my implementation (the HOW part) was conformant to the tests you created (the WHAT perspective), but no one took it into account.</p>
<p>If TDD was to sacrifice performance, increase complexity, depth, coupling and lines of code to write, I wouldn&#8217;t jump in for sure. Fortunately, it is not, as far as I am concerned about. Just an advice, pay much much more attention to the &#8220;WHAT perspective&#8221; next time and make things as simple as possible. I may not know much about the WHAT, but I know a lot of the HOW, since I review, refactor, fine tune and try the simplest wherever possible.</p>
<p>I don&#8217;t want start a war here (we have a lot out there already) and I won&#8217;t go any further on this. Just needed to come up and defend my code. That&#8217;s what I do for living for long.</p>
<p>Thanks and regards,</p>
<p>Luciano Evaristo Guerche (Gorše)<br />
Taboão da Serra, SP, Brazil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SAIF</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4863</link>
		<dc:creator>SAIF</dc:creator>
		<pubDate>Tue, 02 Mar 2010 17:09:14 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4863</guid>
		<description>yes . the code above which is written without TDD is confusing and needs more concentration</description>
		<content:encoded><![CDATA[<p>yes . the code above which is written without TDD is confusing and needs more concentration</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Kruger</title>
		<link>http://jonkruger.com/blog/2010/03/02/a-response-to-the-swe101-attendees-who-tried-to-solve-the-tdd-problem-without-tdd/comment-page-1/#comment-4862</link>
		<dc:creator>Jon Kruger</dc:creator>
		<pubDate>Tue, 02 Mar 2010 15:44:20 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=488#comment-4862</guid>
		<description>@Chuck, 

We did record it.  Hopefully it worked. :)  I'll blog about it if it gets posted somewhere.

Jon</description>
		<content:encoded><![CDATA[<p>@Chuck, </p>
<p>We did record it.  Hopefully it worked. :)  I&#8217;ll blog about it if it gets posted somewhere.</p>
<p>Jon</p>
]]></content:encoded>
	</item>
</channel>
</rss>

