<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Being Cellfish : TDD</title><link>http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx</link><description>Tags: TDD</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Results of a simple TDD experiment</title><link>http://blogs.msdn.com/cellfish/archive/2010/01/06/results-of-a-simple-tdd-experiment.aspx</link><pubDate>Wed, 06 Jan 2010 09:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9944398</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9944398.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9944398</wfw:commentRss><description>Well, I wish it was my own report this time but it isn't. Instead I'd just link to &lt;A href="http://spin.atomicobject.com/2010/01/04/faster-better-cheaper-tdd-wins-in-a-simple-experiment" target=_blank mce_href="http://spin.atomicobject.com/2010/01/04/faster-better-cheaper-tdd-wins-in-a-simple-experiment"&gt;this little experiment&lt;/A&gt;. As mentioned in the comments it is not a statistically proved result but I still think it's good that somebody took their time to add one more data point to the overall statistics. Hey, it inspired me to do that too. Well I probably can't do the same detailed story point per hour thing but I should be able to at least count the number of bugs found in different areas of the code and compare that to complexity and test coverage. No idea if that is interesting but it might be something. Just hope people with more data publish it even if not what they want.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9944398" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Mocking framework comparison</title><link>http://blogs.msdn.com/cellfish/archive/2010/01/03/mocking-framework-comparison.aspx</link><pubDate>Sun, 03 Jan 2010 09:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9936009</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9936009.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9936009</wfw:commentRss><description>&lt;P&gt;As you may know I think &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/17/should-we-be-mocking.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/17/should-we-be-mocking.aspx"&gt;mocks should be used quite carefully&lt;/A&gt;. But as I've pointed out before I think you should use the best tool available and that means to use a mocking framework sometimes. One thing I've never really liked with the typical mocking framework is how it requires you to learn a new API to setup the test double. And if you don't know the API I think a typical mock setup can be very confusing if you see the code for the first time. However if you choose &lt;A href="http://blogs.msdn.com/cellfish/archive/2008/10/14/exit-mocks-enter-stubs.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/10/14/exit-mocks-enter-stubs.aspx"&gt;Stubs&lt;/A&gt; as your framework you get&amp;nbsp;the benefit I'm looking for (primarily not having to hand roll my test doubles). You avoid a powerful framework that can mock things you shouldn't really mock (making your code easier to test by design rather than by use of framework). And also you do not require the user to learn a new API; Stubs uses standard language features (delegates and closures) to setup the stub.&lt;/P&gt;
&lt;P&gt;There is actually a great project where you can compare different mocking frameworks (including Stubs) called &lt;A href="http://code.google.com/p/mocking-frameworks-compare/" target=_blank mce_href="http://code.google.com/p/mocking-frameworks-compare/"&gt;mocking-frameworks-compare&lt;/A&gt; where you can study a number of different tests written with different frameworks. Here is one example from that project using Moq:&lt;/P&gt;&lt;PRE&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;DIV class=csharpcode&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; TouchHotIron_Yell()
&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{
&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    var hand = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Mock&amp;lt;IHand&amp;gt;();
&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    var mouth = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Mock&amp;lt;IMouth&amp;gt;();
&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;    hand.Setup(x =&amp;gt; x.TouchIron(Match&amp;lt;Iron&amp;gt;.Create(x =&amp;gt; x.IsHot))).Throws(&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; BurnException());
&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;    var brain = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Brain(hand.Object, mouth.Object);
&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;    brain.TouchIron(&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Iron { IsHot = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt; });
&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;    mouth.Verify(x =&amp;gt; x.Yell()); 
&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;}
&lt;/DIV&gt;&lt;/PRE&gt;
&lt;P&gt;If you're not used to Moq I think there are a number of things that stand out as weird. First of all there is no &lt;EM&gt;assert&lt;/EM&gt; in the test. Second the setup is not obvious. And it is not obvious that we are verifying &lt;EM&gt;Yell&lt;/EM&gt; is being called or if &lt;EM&gt;Yell&lt;/EM&gt; is going to be called by the verify method. Now, let's look at the same test using Stubs:&lt;/P&gt;&lt;PRE&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;DIV class=csharpcode&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; TouchHotIron_Yell()
&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{
&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    var hand = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; SIHand();
&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    var mouth = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; SIMouth();
&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;    hand.TouchIron = (iron) =&amp;gt;
&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;    {
&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (iron.IsHot)
&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;            &lt;SPAN class=kwrd&gt;throw&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; BurnException();
&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;    };
&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt; yelled = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;
&lt;SPAN class=lnum&gt;  12:  &lt;/SPAN&gt;    mouth.Yell = () =&amp;gt; yelled = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;
&lt;SPAN class=lnum&gt;  13:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  14:  &lt;/SPAN&gt;    var brain = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Brain(hand, mouth);
&lt;SPAN class=lnum&gt;  15:  &lt;/SPAN&gt;    brain.TouchIron(&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Iron { IsHot = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt; });
&lt;SPAN class=lnum&gt;  16:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  17:  &lt;/SPAN&gt;    Assert.IsTrue(yelled);
&lt;SPAN class=lnum&gt;  18:  &lt;/SPAN&gt;}
&lt;/DIV&gt;&lt;/PRE&gt;
&lt;P&gt;You might notice that the test is a little longer and feels more verbose. But that is not necessarily a bad thing. On the contrary I think that is a good thing. Also the only framework specifics you need to know is to use the stub-class and know it has a property to define behavior. Apart from that there is also a performance benefit from using Stubs which you can read more about &lt;A href="http://blog.dotnetwiki.org/CommentView,guid,7c5d5cdd-7ebc-4a3d-8fb1-e84b187343b2.aspx" target=_blank mce_href="http://blog.dotnetwiki.org/CommentView,guid,7c5d5cdd-7ebc-4a3d-8fb1-e84b187343b2.aspx"&gt;here&lt;/A&gt; (note that the support for partial mocks that is mentioned as not yet supported is now supported). All this things considered I think Stubs is the best mocking&amp;nbsp;framework choice you can do today.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Preemptive comment answer&lt;/STRONG&gt;&lt;/EM&gt;: &lt;EM&gt;But Stubs is not a mocking framework! &lt;/EM&gt;Well I think it is because I can create mock objects, fakes and stubs (i.e. any kind of &lt;A href="http://blogs.msdn.com/cellfish/archive/2008/04/22/mocks-are-not-stubs.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2008/04/22/mocks-are-not-stubs.aspx"&gt;test double&lt;/A&gt;) with it. So the same thing as Moq or RhinoMocks for example. Same, same, but different...&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9936009" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Advent calendar 2009 - how to TDD thread safety</title><link>http://blogs.msdn.com/cellfish/archive/2009/11/28/advent-calendar-2009-how-to-tdd-thread-safety.aspx</link><pubDate>Sun, 29 Nov 2009 07:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9929775</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9929775.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9929775</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://blogs.msdn.com/cellfish/pages/christmas-2008.aspx" mce_href="http://blogs.msdn.com/cellfish/pages/christmas-2008.aspx"&gt;Last year I wrote the same test in 24 different ways&lt;/A&gt; as a little advent calendar for you to enjoy. This year I'm going to do something similar but also a little bit different. I'm going to start with a simple piece of code and then show how this code can be tested for thread safety in different ways. I think it's pretty common to think that thread safety is one of those things that are really hard to test and something you typically handle by good practices and code reviews. Very similar to logging in an application. Most people don't TDD their logs. But why not? Personally I've experienced situations where fixing a bug means making something thread safe or adding a better log message. When I do this I want a test to reproduce the bug and verify the fix. These tests are typically hard to write since the code was not written to be easily tested in regards to logging or thread safety. But it doesn't have to be that way. For example there is a testing framework that basically works with verifying logs (&lt;A href="http://texttest.carmen.se/" target=_blank mce_href="http://texttest.carmen.se/"&gt;TextTest&lt;/A&gt;) and thread safety can absolutely be designed using TDD. Remember;&lt;EM&gt; if you think it is hard, you're probably doing something wrong&lt;/EM&gt;. Let's decide after Christmas if test driving thread safety is better than the standard way of just adding it where &lt;EM&gt;you know it is needed&lt;/EM&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9929775" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Christmas/default.aspx">Christmas</category></item><item><title>Team Coding Dojo 7</title><link>http://blogs.msdn.com/cellfish/archive/2009/11/06/team-coding-dojo-7.aspx</link><pubDate>Fri, 06 Nov 2009 14:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9918373</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9918373.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9918373</wfw:commentRss><description>&lt;P&gt;This time we did a new Kata - variant of &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?KataPokerHands" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?KataPokerHands"&gt;poker hands&lt;/A&gt;. Instead of being so specific about the interface the user story we used for the Kata was simply; &lt;EM&gt;Given two five card hands I want to know which hand is the winner&lt;/EM&gt;. We also choose to use the &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx"&gt;object calisthenics rules&lt;/A&gt;. The biggest benefit from not having a specified interface was that we did not have to do any string parsing and could design our interface as we wanted. That definitely felt like a kick start for an object calisthenics session. In the retrospect we also noted that in some cases it is good to bend the object calisthenics rules for the sake of progress with the Kata. Sometimes it is just not worth following the rules strictly. But each breach of the rules should be carefully considered since the purpose of the rules is to flush out changes you would normally never see.&lt;/P&gt;
&lt;P&gt;The poker Kata is definitely an interesting one and I can see how the solution can take many different paths. Looking forward to try it again.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918373" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Refactoring is not rewriting</title><link>http://blogs.msdn.com/cellfish/archive/2009/11/04/refactoring-is-not-rewriting.aspx</link><pubDate>Thu, 05 Nov 2009 04:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9917741</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9917741.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9917741</wfw:commentRss><description>&lt;P&gt;Today I got that feeling of how the use of one word, interpreted differently by different people result in misunderstandings. It was when I read &lt;A href="http://blogs.msdn.com/cashto/archive/2009/03/31/it-s-ok-not-to-write-unit-tests.aspx" target=_blank mce_href="http://blogs.msdn.com/cashto/archive/2009/03/31/it-s-ok-not-to-write-unit-tests.aspx"&gt;this&lt;/A&gt; which IMHO is full of misunderstandings (including some of the comments). One example is that refactorings must break unit tests. No that can never happen because refactoring is about &lt;A href="http://en.wikipedia.org/wiki/Refactor" target=_blank mce_href="http://en.wikipedia.org/wiki/Refactor"&gt;changing internal structure and design without changing the functionality&lt;/A&gt;. What is typically a pain with a bunch of unit tests in place is when you realize your design sucks and you want to &lt;EM&gt;rewrite&lt;/EM&gt; something. The border when you go from refactor to rewrite may be gray but refactorings are always small and should never change the functionality (including the API). So when I say unit tests makes it easier for me to do refactorings that says nothing about when I need rewrite/change something.&lt;/P&gt;
&lt;P&gt;There is a valid point that having unit tests means you have to change unit tests when you need to rewrite/change something. But if you've written your unit tests and code in a good way this impact should&amp;nbsp;be small. Just because you feel something makes your life harder sometimes does not mean&amp;nbsp;it is wrong, it might mean you're doing it wrong. And one way to prevent yourself from&amp;nbsp;having to do these cumbersome rewritings is to make sure your code is very simple and that each entity only does one thing. Something that happens almost by itself if you're doing TDD... In my experience, every time I find a solution hard to test or hard to change because the tests breaks massively with a small change, it does not mean TDD is a bad idea. It has always meant that I should solve the problem in a different way where the code is easy to test and tests are not fragile.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9917741" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Coding Dojo 6</title><link>http://blogs.msdn.com/cellfish/archive/2009/10/05/coding-dojo-6.aspx</link><pubDate>Tue, 06 Oct 2009 08:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9903539</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9903539.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9903539</wfw:commentRss><description>&lt;P&gt;It was &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx"&gt;MineSweeper&lt;/A&gt; for the 6th &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo"&gt;MSFTCorpDojo&lt;/A&gt; today. We also applied the &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx"&gt;object calisthenics rules&lt;/A&gt; this time. We ended up with a lot of interesting discussions on how to design to follow the calisthenics rules and this lead us to not really driving the design using tests but rather to create tests following the design. In my opinion it was also unsatisfying that we only implemented the small building blocks we thought we needed and almost no part of the algorithm needed to solve the problem. After using object calisthenics a few times it feels like it leads to interesting design discussions at the expense of the basic TDD experience. It'll be interesting to see if we'll be able to get both in the next session.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9903539" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Coding Dojo 5</title><link>http://blogs.msdn.com/cellfish/archive/2009/09/02/coding-dojo-5.aspx</link><pubDate>Wed, 02 Sep 2009 19:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890225</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9890225.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9890225</wfw:commentRss><description>&lt;P&gt;Yesterday was the fifth &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo"&gt;MSFTCorpDojo&lt;/A&gt;. &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx"&gt;MineSweeper&lt;/A&gt; as usual and we tried switching person at keyboard on each arrow in the TDD cycle (and not really pairing). As &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/05/coding-dojo-4.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/05/coding-dojo-4.aspx"&gt;last time&lt;/A&gt; we tried BDD style tests. Didn't end up quite as neat as last time but we still learned something. I also noticed that everybody was very engaged this time. Don't know if it was the attendees or the fact that you could end up at the keyboard very soon all the time. Anyway I think we'll decide who goes next by random next time. Just to keep everybody on their toes... Will be interesting to see how that works. We'll also try to apply the &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx"&gt;object calisthenics rules&lt;/A&gt; next time.&lt;/P&gt;
&lt;P&gt;This time it was also very clear how one person's decision on how to write a test or how to implement one thing may drive the complete solution in one direction unless you decide to do major refactorings. We also had to remind our selfs a few times not to &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/06/25/making-the-smallest-change-to-make-a-test-pass-is-not-the-same-thing-as-making-the-simplest-change.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/06/25/making-the-smallest-change-to-make-a-test-pass-is-not-the-same-thing-as-making-the-simplest-change.aspx"&gt;do the smallest or dumbest change to make a test path but actually the simplest thing&lt;/A&gt;. I think it was nice how we sometimes tried to much, recognized that fast, backed out and did a simpler thing.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890225" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Team Coding Dojo 5</title><link>http://blogs.msdn.com/cellfish/archive/2009/08/26/team-coding-dojo-5.aspx</link><pubDate>Thu, 27 Aug 2009 09:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9886584</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9886584.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9886584</wfw:commentRss><description>&lt;P&gt;This time we took the completed &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR"&gt;BankOCR&lt;/A&gt; Kata from&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/07/29/team-coding-dojo-4.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/07/29/team-coding-dojo-4.aspx"&gt; last time&lt;/A&gt; and tried to refactor it using the &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx"&gt;object calisthenics rules&lt;/A&gt;. It was really fun and the dojo was quite different from the other dojos which has been more TDD focus. This time we had a lot of design discussions and we had to force our selfs to just do some refactoring and see where it took us. I think it was great to see how we refactored and created new classes just to later refactor these classes to nothing and removing them. It was a great experience in how refactoring in steps reveals the design for you. We also had the full test suite save us a bunch of times from stupid bugs which is also nice.&lt;/P&gt;
&lt;P&gt;But refactoring existing code to follow the object calisthenics rules is very hard and takes time. So there is much more work to do. We decided that we maybe want to continue this exercise later but for our next team dojo we will try a new Kata and apply the object calisthenics rules from the beginning trying to keep the code base conformed to those rules at all times. Also we want a Kata with no string parsing of two dimensional things...&lt;/P&gt;
&lt;P&gt;We actually did another fun thing. After the dojo we went to watch &lt;A title="District 9" href="http://www.d-9.com/" target=_blank mce_href="http://www.d-9.com/"&gt;D9&lt;/A&gt; at a local cinema. A great finale!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9886584" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Object Calisthenics: First contact</title><link>http://blogs.msdn.com/cellfish/archive/2009/08/15/object-calisthenics-first-contact.aspx</link><pubDate>Sun, 16 Aug 2009 06:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9871363</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9871363.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9871363</wfw:commentRss><description>&lt;P&gt;A few weeks ago I was introduced the the object calisthenics described by Jeff Bay in the book &lt;EM&gt;The ThoughtWorks Anthology&lt;/EM&gt;. The object calisthenics is a way to practice writing object oriented code. The nine rules of are &lt;STRONG&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;/STRONG&gt; intended to be used in your every day work. The rules are intended to be used on a small problem such as a &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?KataCatalogue" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?KataCatalogue"&gt;coding Kata&lt;/A&gt;. The idea is that by applying these strict rules on a small problem you'll learn to write better code.&lt;/P&gt;
&lt;P&gt;So I decided to try this on the &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx"&gt;MineSweeper Kata&lt;/A&gt;. In the beginning I decided to try to conform to the rules all the time, but pretty soon I changed my mind and wrote a working solution and then started to refactored to conform to the rules. I think this was a mistake. Some design decisions turned out to require very big refactorings when conforming to the rules and I actually never got all the way. But this doesn't mean I didn't learn anything. First of all I think I experienced a variant of &lt;EM&gt;you can't test in quality, you have to build it in&amp;nbsp;from the start&lt;/EM&gt;. I should have stuck with the initial strategy and make sure the code followed the rules all the time. I also learned that classes that I felt were really small and doing only one thing actually could be split up when I had to in order to conform to the rules. Reminds me of when people thought atoms were the smallest building blocks of the universe and then it turned out to be something smaller...&lt;/P&gt;
&lt;P&gt;So all in all I think doing a coding Kata while applying the object calisthenics rules will improve my ability to write object oriented code. And it will be interesting to see how it works out in a &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/07/29/team-coding-dojo-4.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/07/29/team-coding-dojo-4.aspx"&gt;coding dojo&lt;/A&gt;. By now you're probably wondering what the nine rules are. The rules are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/16/object-calisthenics-rule-1-use-one-level-of-indentation-per-method.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/16/object-calisthenics-rule-1-use-one-level-of-indentation-per-method.aspx"&gt;Use one level of indentation per method&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/17/object-calisthenics-rule-2-don-t-use-the-else-keyword.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/17/object-calisthenics-rule-2-don-t-use-the-else-keyword.aspx"&gt;Don't use the &lt;EM&gt;else&lt;/EM&gt; keyword&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/18/object-calisthenics-rule-3-wrap-all-primitives-and-strings.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/18/object-calisthenics-rule-3-wrap-all-primitives-and-strings.aspx"&gt;Wrap all primitives and strings&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/19/object-calisthenics-rule-4-use-only-one-dot-per-line.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/19/object-calisthenics-rule-4-use-only-one-dot-per-line.aspx"&gt;Use only one dot per line&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/20/object-calisthenics-rule-5-don-t-abbreviate.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/20/object-calisthenics-rule-5-don-t-abbreviate.aspx"&gt;Don't abbreviate&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/21/object-calisthenics-rule-6-keep-all-entities-small.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/21/object-calisthenics-rule-6-keep-all-entities-small.aspx"&gt;Keep all entities small&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/22/object-calisthenics-rule-7-don-t-use-any-classes-with-more-than-two-instance-variables.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/22/object-calisthenics-rule-7-don-t-use-any-classes-with-more-than-two-instance-variables.aspx"&gt;Don't use any classes with more than two instance variables&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/23/object-calisthenics-rule-8-use-first-class-collections.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/23/object-calisthenics-rule-8-use-first-class-collections.aspx"&gt;Use first class collections&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/08/24/object-calisthenics-rule-9-don-t-use-any-getters-setters-or-properties.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/08/24/object-calisthenics-rule-9-don-t-use-any-getters-setters-or-properties.aspx"&gt;Don't use any getters, setters or properties&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I'll go into more detail of these nine rules over the next few days.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9871363" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Development/default.aspx">Development</category></item><item><title>What is a Coding Dojo?</title><link>http://blogs.msdn.com/cellfish/archive/2009/08/08/what-is-a-coding-dojo.aspx</link><pubDate>Sun, 09 Aug 2009 08:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9861948</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9861948.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9861948</wfw:commentRss><description>&lt;P&gt;I've heard that some people don't think the &lt;A href="http://codingdojo.org/" target=_blank mce_href="http://codingdojo.org"&gt;CodingDojo site&lt;/A&gt; tells you a lot about what to expect in a coding dojo. It's more about practical things and listing a number of good problems to solve during the dojo. So I'll try to elaborate. In a coding dojo you will learn something. It might be TDD if you don't know a lot about it or it might be some smart trick in the development environment. You will also learn something about how others write their code. You will learn this since a typical dojo is setup with one computer desktop projected on the wall and all participants takes turns at the keyboard. You should not be intimidated by the fact that you will code in front of others for a few minutes. People attending dojos typically like to teach and learn so you will get help from the group.&lt;/P&gt;
&lt;P&gt;You should not expect to see the announced problem being solved. In my experience it is very rare that a dojo ends with a complete solution. And completing is not the goal. Learning along the way is the important thing. A coding dojo is a safe environment where you can try new ideas and make mistakes without&amp;nbsp;putting your real work at risk. A coding dojo is also a great opportunity to improve your development skills.&lt;/P&gt;
&lt;P&gt;A typical dojo starts with a short introduction to the environment and a short design discussion. In most dojos two people then starts coding as a pair. After a few minutes (typically around five) one person in the pair gets substituted by somebody else in the group and so on. Even though the person at the keyboard is in command, the whole group typically participates giving suggestions on what to do. If more discussion is needed, that is done without stopping the timer counting down to the next switch. The dojo ends with a retrospect so that the dojo can be improved to the next time.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9861948" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Coding Dojo 4</title><link>http://blogs.msdn.com/cellfish/archive/2009/08/05/coding-dojo-4.aspx</link><pubDate>Thu, 06 Aug 2009 08:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9858710</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9858710.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9858710</wfw:commentRss><description>&lt;P&gt;Fourth &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo"&gt;MSFTCorpDojo&lt;/A&gt; today. &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx" target=_blank mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx"&gt;MineSweeper&lt;/A&gt; and &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MicroPairing" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MicroPairing"&gt;MicroPairing&lt;/A&gt; this time too.This time we, as a result of the retrospect from &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/07/06/coding-dojo-3.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/07/06/coding-dojo-3.aspx"&gt;last time&lt;/A&gt;, we did BDD-style testing (I've added one of the test classes below as an example). We decided to start by implementing a parser that parsed the input and created an internal representation of the input that we could later use to generate the output. By the end of the session we had a pretty complete parser with error handling for all kinds of bad input. This is one of the few times I've seen any real error handling in a dojo.&lt;/P&gt;
&lt;P&gt;This time in the retrospect we said that the next time we should implement the other part next time. That is; assume a parsed input in some internal representation and generate the output from that. We also talked about how we do MicroPairing and switch one person in the pair every seven minutes. We decided to next time switch one person in the pair every time the keyboard gets passed instead. Guess that will mean less pair programming since there is no real ping-pong but rather a circular queue. But in our session almost everybody participates all the time anyway so that might not necessarily be a problem.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;/P&gt;&lt;PRE&gt;&lt;DIV class=csharpcode&gt;
&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Given_a_single_1x1_fieldset_with_no_bombs
&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;    {
&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; input;
&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; Field field;
&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; Given_a_single_1x1_fieldset_with_no_bombs()
&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;        {
&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;            input = &lt;SPAN class=str&gt;"1 1"&lt;/SPAN&gt; + Environment.NewLine +
&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;                    &lt;SPAN class=str&gt;"."&lt;/SPAN&gt; + Environment.NewLine +
&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;                    &lt;SPAN class=str&gt;"0 0"&lt;/SPAN&gt;;
&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;            field = FieldParser.Parse(input).Single();
&lt;SPAN class=lnum&gt;  12:  &lt;/SPAN&gt;        }
&lt;SPAN class=lnum&gt;  13:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  14:  &lt;/SPAN&gt;        [Fact]
&lt;SPAN class=lnum&gt;  15:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; It_should_have_one_row()
&lt;SPAN class=lnum&gt;  16:  &lt;/SPAN&gt;        {
&lt;SPAN class=lnum&gt;  17:  &lt;/SPAN&gt;            Assert.Equal(1, field.Rows);
&lt;SPAN class=lnum&gt;  18:  &lt;/SPAN&gt;        }
&lt;SPAN class=lnum&gt;  19:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  20:  &lt;/SPAN&gt;        [Fact]
&lt;SPAN class=lnum&gt;  21:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; It_should_have_one_column()
&lt;SPAN class=lnum&gt;  22:  &lt;/SPAN&gt;        {
&lt;SPAN class=lnum&gt;  23:  &lt;/SPAN&gt;            Assert.Equal(1, field.Columns);
&lt;SPAN class=lnum&gt;  24:  &lt;/SPAN&gt;        }
&lt;SPAN class=lnum&gt;  25:  &lt;/SPAN&gt;&amp;nbsp;
&lt;SPAN class=lnum&gt;  26:  &lt;/SPAN&gt;        [Fact]
&lt;SPAN class=lnum&gt;  27:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; It_should_have_an_empty_square_0_0()
&lt;SPAN class=lnum&gt;  28:  &lt;/SPAN&gt;        {
&lt;SPAN class=lnum&gt;  29:  &lt;/SPAN&gt;            Assert.False(field.IsBomb(0, 0));
&lt;SPAN class=lnum&gt;  30:  &lt;/SPAN&gt;        }
&lt;SPAN class=lnum&gt;  31:  &lt;/SPAN&gt;    }
&lt;/DIV&gt;&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9858710" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Visual Studio Options for TDD revisited</title><link>http://blogs.msdn.com/cellfish/archive/2009/07/31/visual-studio-options-for-tdd-revisited.aspx</link><pubDate>Fri, 31 Jul 2009 17:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9852941</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9852941.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9852941</wfw:commentRss><description>&lt;P&gt;So I &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/07/28/visual-studio-options-for-tdd.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/07/28/visual-studio-options-for-tdd.aspx"&gt;previously mention&lt;/A&gt; a neat way to set up visual studio to work with a console test runner so you don't switch to the error list all the time. There is a potential problem here. Sometimes you add a compilation error to the code. In this case the post build step will still be executed with the old binary and since we don't switch to the error list and just look at the output window we might miss the compilation errors. This is not a good thing...&lt;/P&gt;
&lt;P&gt;The solution is however pretty easy. In your assembly with all your tests you have a post-build step to run the test runner. What you need to do is to add a pre-build step to your &lt;EM&gt;production assembly&lt;/EM&gt;, i.e. the assembly you're testing looking like this:&lt;STRONG&gt; &lt;SPAN lang=""&gt;del $(TargetPath)&lt;/P&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;
&lt;P&gt;This way, if there is a compilation error in your production code you'll get an error when you try to run the tests since the production assembly will be deleted for sure.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9852941" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Team Coding Dojo 4</title><link>http://blogs.msdn.com/cellfish/archive/2009/07/29/team-coding-dojo-4.aspx</link><pubDate>Thu, 30 Jul 2009 07:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9852915</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9852915.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9852915</wfw:commentRss><description>&lt;P&gt;This time we diverted from what I think is a basic dojo rule; you start over each time. So we continued with our &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR"&gt;BankOCR&lt;/A&gt; variant from &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/06/24/team-coding-dojo-3.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/06/24/team-coding-dojo-3.aspx"&gt;last time&lt;/A&gt; and actually finished it including extending the number of digits and having three different checksum variants. This time we made one mistake. Or maybe I did since I maybe should moderate the session harder. And that was that we got a little carried away to get things done rather than refactoring at certain times. In the end the code turned out pretty OK but the way there was shaky with pretty complex implementations at some times.&lt;/P&gt;
&lt;P&gt;In the end it sounded like the participants were pretty happy with the session and we decided to actually continue the next dojo session with the same kata and code base but next time focusing on refactoring the code into something more object orientated using the&amp;nbsp;&lt;A title="One of many descriptions" href="http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html" target=_blank mce_href="http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html"&gt;nine Object Calisthenics rules&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9852915" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Visual Studio Options for TDD</title><link>http://blogs.msdn.com/cellfish/archive/2009/07/28/visual-studio-options-for-tdd.aspx</link><pubDate>Wed, 29 Jul 2009 06:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9851676</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9851676.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9851676</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://blogs.msdn.com/photos/cellfish/images/9851667/original.aspx" target=_blank mce_href="http://blogs.msdn.com/photos/cellfish/images/9851667/original.aspx"&gt;&lt;IMG style="WIDTH: 425px; HEIGHT: 247px" title="TDD Build Options" border=0 alt="TDD Build Options" align=right src="http://blogs.msdn.com/photos/cellfish/images/9851667/425x247.aspx" width=425 height=247 mce_src="http://blogs.msdn.com/photos/cellfish/images/9851667/425x247.aspx"&gt;&lt;/A&gt;When I first started using &lt;A href="http://xunit.codeplex.com/" target=_blank mce_href="http://xunit.codeplex.com/"&gt;xUnit.net&lt;/A&gt; the only feasible way to run the tests for me was to use the console test runner as a post build event in visual studio. The only annoying thing about the default settings in visual studio with this setup however is that whenever there was a test failure visual studio switches to the error window which doesn't tell me more than the number of failed tests (since the return code is the number of failing tests). But there is a way to tweak your environment to always show the output window where all the interesting things about the tests are printed.&lt;/P&gt;
&lt;P&gt;Take a look at the options dialog showed to the right. By disabling the "&lt;EM&gt;Always show Error List if build finishes with errors&lt;/EM&gt;" and also checking "&lt;EM&gt;Show Output window when build starts&lt;/EM&gt;" you'll make sure you'll have the console output handy if the build fails with unit tests. The drawback however is that for all compilation errors (and warnings) you'll have to switch to the error list window. But personally I see more test failures than actual build failures when I develop code so all in all it's a win for me with these changes.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9851676" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Coding Dojo 3</title><link>http://blogs.msdn.com/cellfish/archive/2009/07/06/coding-dojo-3.aspx</link><pubDate>Tue, 07 Jul 2009 07:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9821442</guid><dc:creator>cellfish</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/cellfish/comments/9821442.aspx</comments><wfw:commentRss>http://blogs.msdn.com/cellfish/commentrss.aspx?PostID=9821442</wfw:commentRss><description>&lt;P&gt;Third &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MSFTCorpDojo"&gt;MSFTCorpDojo&lt;/A&gt; today and&amp;nbsp;&lt;A href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/02/19/minesweeper-kata-reflections.aspx"&gt;MineSweeper&lt;/A&gt; and &lt;A href="http://codingdojo.org/cgi-bin/wiki.pl?MicroPairing" target=_blank mce_href="http://codingdojo.org/cgi-bin/wiki.pl?MicroPairing"&gt;MicroPairing&lt;/A&gt; again. We did almost no design this time and started with only end-to-end tests. In my opinion the purest way of executing a kata. We had very good progress in the first hour but started refactoring our tests quite hard, something I've never seen to this extent before in any dojo session I've ever attended. The result was that we did not complete the kata but we ended up with eleven really nice tests with a few nice helper methods. And if we've spent another 20 or 30 minutes we would probably have seen classes (or at least one)&amp;nbsp;emerge from the code all by them selfs, just as I expect it to be. All in all a great session.&lt;/P&gt;
&lt;P&gt;I especially like the fact that one of the participants did not do any coding in his daily work and had never tried TDD at all before the session. And he felt he really learned something and that he felt he could contribute and participate as any other person in the room. I guess that proofs how well the dojo format works for all kinds of skill levels.&lt;/P&gt;
&lt;P&gt;I only really experienced one big setback today and that was when we did a 10+minute refactoring that involved more than one person to complete. The refactoring was in the test code and created a very general method to generate input and output data for our tests. I'm personally not sure that refactoring really added value in terms of &lt;A href="http://blogs.msdn.com/cellfish/archive/2009/06/11/test-readability.aspx" mce_href="http://blogs.msdn.com/cellfish/archive/2009/06/11/test-readability.aspx"&gt;readability&lt;/A&gt;. I would personally have sticked with a much less generic and simple way of implementing my tests even though it would have left me with a few more hard coded strings. But I think that is OK in the test code if it increases readability. On the other hand we got a really nice generic method to use in future tests so I guess it's a trade off as usual and you should do what you think is best in each situation.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9821442" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/cellfish/archive/tags/BDD/default.aspx">BDD</category><category domain="http://blogs.msdn.com/cellfish/archive/tags/TDD/default.aspx">TDD</category></item></channel></rss>