<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-34908752</id><updated>2008-10-07T13:29:06.787+01:00</updated><title type='text'>Mock Objects</title><subtitle type='html'>About Mock Objects, a technique for improving the design of code within Test-Driven Development</subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/'/><link rel='next' type='application/atom+xml' href='http://www.mockobjects.com/atom.xml?start-index=26&amp;max-results=25'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.mockobjects.com/atom.xml'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>69</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-34908752.post-6215585331821856039</id><published>2008-09-25T20:30:00.002+01:00</published><updated>2008-09-25T20:32:32.777+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mocks in action'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='testability'/><title type='text'>TDD. Killing the messenger?</title><content type='html'>&lt;p&gt;Are we really doomed to another generation of procedural code masquerading as objects?&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/rosherove/archive/2008/09/20/goodbye-mocks-farewell-stubs.aspx"&gt;Roy Osherove&lt;/a&gt; has come out against "mocking" in favour of "isolating". One reading of his point is that mocking is just too hard for the bulk of the programmers he sees. Perhaps that's true (the others developers who discovered the technique are all very good) but I hope not (either that or I should increase my rates). And I'm pleased to see &lt;a href="http://ayende.com/Blog/archive/2008/09/23/cuddling-is-consider-harmful.aspx"&gt;Oren&lt;/a&gt;, for one, has responded.&lt;/p&gt;

&lt;p&gt;Roy addresses important issues which we need to think about, but we shouldn't pitch the whole industry at the level of its least skilled members; I've spent too much of my life cleaning up code that should never have been written in the first place. In the meantime, if his staff don't understand basic Object-Orientation, then that's what he should be teaching first, with a sprinkling of acceptance testing on top for regression.
&lt;/p&gt;

&lt;p&gt;Reading the post and its comments again, I see repeated "Doctor, it hurts when I do that" moments. Roy's response is to back off interaction testing, but that misses the experience and insight that led us into this situation in the first place. My call is that, like Object-Orientation, the technique is widely misunderstood, which is why the same objections keep coming back. This isn't a comfortable position.
&lt;/p&gt;

&lt;p&gt;To take the most obvious example, as Roy says himself, record/replay just doesn't cut it. That's why we've never supported it. It's easy to start with, but then my experience is that it encourages unmaintainable tests. It focusses the language of a test on the accident of the current implementation, rather than on the significant relationships between objects. It also encourages asserting every interaction, which leads to just the sort of problem that everyone complains about, brittle overspecified tests. That's why we don't do it, we only assert interactions that can affect the world around the object under test and stub the rest.
&lt;/p&gt;

&lt;p&gt;The other disaster (yes, I think record/replay has been a disaster) was our early attempt to mock the entire Java libraries. Apart from being unrealistic, it sent entirely the wrong message, emphasising isolating from databases over guiding the design. Later, Joe Walnes coined the notion of "Only Mock types you own", which really helped some people get the idea.
&lt;/p&gt;

&lt;p&gt;
As someone posted somewhere in this exchange, TDD will punish you if you don't understand design. I'd argue that that's what it's &lt;em&gt;for&lt;/em&gt;, and that it's essential to listen to what the tests are saying rather than turning down the volume.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/6215585331821856039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=6215585331821856039' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6215585331821856039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6215585331821856039'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/09/tdd-killing-messenger.html' title='TDD. Killing the messenger?'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-1866667085705153978</id><published>2008-09-23T08:44:00.003+01:00</published><updated>2008-09-23T19:19:13.152+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Reordering chapters</title><content type='html'>&lt;p&gt;We've cut down the introduction and moved some of the material into a new section, &lt;em&gt;Examining the Process&lt;/em&gt;. &lt;a href="/book"&gt;Check it out and let us know what you think&lt;/a&gt;. More content to follow soon.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/1866667085705153978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=1866667085705153978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1866667085705153978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1866667085705153978'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/09/reordering-chapters.html' title='Reordering chapters'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-2018949831318665434</id><published>2008-09-04T08:03:00.005+01:00</published><updated>2008-09-23T08:43:52.450+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Chapter 9. Passing the First Test</title><content type='html'>&lt;p&gt;We've posted &lt;a href="http://www.mockobjects.com/book/example.passing-the-first-test.html"&gt;another episode&lt;/a&gt; from our long worked example.&lt;/p&gt;

&lt;blockquote&gt;At the start of every test run, we need our test script to start up the Openfire server, create accounts for the Sniper and Auction, and then run the tests. Each test will start instances of the application and fake auction and test their communication through the server.&lt;/blockquote&gt;

&lt;p&gt;We've also made some changes in response to comments on &lt;a href="http://www.mockobjects.com/book/example.passing-the-first-test.html"&gt;the discussion list&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/2018949831318665434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=2018949831318665434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2018949831318665434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2018949831318665434'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/09/chapter-9-passing-first-test.html' title='Chapter 9. Passing the First Test'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-564167118864406992</id><published>2008-08-28T10:44:00.002+01:00</published><updated>2008-08-28T10:47:46.592+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Long Worked Example</title><content type='html'>&lt;p&gt;We've posted the first couple of chapters of the long worked example from our book, &lt;a href="/book"&gt;Growing Object Oriented Software Guided by Tests&lt;/a&gt;.  It's work in progress: some of the diagrams have not been finished quite yet.  As ever, feedback is welcome via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/564167118864406992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=564167118864406992' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/564167118864406992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/564167118864406992'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/08/long-worked-example.html' title='Long Worked Example'/><author><name>Nat Pryce</name><uri>http://www.blogger.com/profile/14593335423887511402</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-1932381629602196613</id><published>2008-08-21T23:03:00.003+01:00</published><updated>2008-08-21T23:07:06.724+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>New Table of Contents Online</title><content type='html'>We've posted the new &lt;a href="/book/index.html"&gt;Table of Contents&lt;/a&gt;.  From now on, we'll update this as we put chapters online and shuffle content about.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/1932381629602196613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=1932381629602196613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1932381629602196613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1932381629602196613'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/08/new-table-of-contents-online.html' title='New Table of Contents Online'/><author><name>Nat Pryce</name><uri>http://www.blogger.com/profile/14593335423887511402</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-3832507931748878177</id><published>2008-08-21T13:59:00.008+01:00</published><updated>2008-08-26T23:20:47.087+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Chapter 5. An Introduction to the Tools</title><content type='html'>&lt;p&gt;We have put a new chapter of the &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;book&lt;/a&gt; online: &lt;a href="/book/tdd-tools-api-intro.html"&gt;Chapter 5. An Introduction to the Tools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What happened to chapter 4?  We've moved some chapters around after reading people's comments in the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and will publish chapter 4 as soon as we've finished it and polished it up.  We'll put the new table of contents up ASAP.&lt;/p&gt;

&lt;p&gt;You can give comments and feedback via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; or as blog comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; explained why we are only giving a cursory introduction to the tools.  Improve explanation of why we chose JUnit and include where you can download it from.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/3832507931748878177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=3832507931748878177' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3832507931748878177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3832507931748878177'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/08/chapter-5-introduction-to-tools.html' title='Chapter 5. An Introduction to the Tools'/><author><name>Nat Pryce</name><uri>http://www.blogger.com/profile/14593335423887511402</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-1327875878353912862</id><published>2008-08-06T11:52:00.006+01:00</published><updated>2008-08-26T23:22:09.204+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Chapter 3. Kick-Starting the Test-Driven Cycle</title><content type='html'>&lt;p&gt;We have put a new chapter of the &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;book&lt;/a&gt; online: &lt;a href="/book/kickstarting-tdd.html"&gt;Chapter 3. Kick-Starting the Test-Driven Cycle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can give comments and feedback via the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; or as blog comments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; added a sidebar about kick-starting "brownfield" development.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/1327875878353912862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=1327875878353912862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1327875878353912862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1327875878353912862'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/08/chapter-3-kick-starting-test-driven.html' title='Chapter 3. Kick-Starting the Test-Driven Cycle'/><author><name>Nat Pryce</name><uri>http://www.blogger.com/profile/14593335423887511402</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-1803261065041684719</id><published>2008-07-25T12:50:00.004+01:00</published><updated>2008-08-07T11:14:00.276+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Chapter 2. Test-Driven Development with Objects</title><content type='html'>&lt;p&gt;We are now publishing chapters of our book, &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;Growing Object-Oriented Software Guided by Tests&lt;/a&gt; in a separate section of the site. We will publish news about new content in the blog but will not include the entire contents of each chapter as blog posts.&lt;/p&gt;
&lt;p&gt;We have updated Chapter 2, &lt;a href="/book/tdd-with-objects-intro.html"&gt;Test-Driven Development with Objects&lt;/a&gt; in response to feedback from blog comments and the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and improved some of the diagrams.  More comments are always welcome.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/1803261065041684719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=1803261065041684719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1803261065041684719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/1803261065041684719'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/07/chapter-2-test-driven-development-with.html' title='Chapter 2. Test-Driven Development with Objects'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-482063379702960285</id><published>2008-07-16T13:13:00.003+01:00</published><updated>2008-07-16T13:16:47.975+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Book Discussion Group</title><content type='html'>&lt;p&gt;We have created a &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;Yahoo Group&lt;/a&gt; to host feedback and discussion about &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;the book&lt;/a&gt; we're working on.  If you have &lt;em&gt;any&lt;/em&gt; feedback we'd love to hear from you.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/482063379702960285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=482063379702960285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/482063379702960285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/482063379702960285'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/07/book-discussion-group.html' title='Book Discussion Group'/><author><name>Nat Pryce</name><uri>http://www.blogger.com/profile/14593335423887511402</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-6456729585893974156</id><published>2008-07-14T21:34:00.013+01:00</published><updated>2008-08-07T11:13:12.330+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Chapter 1. What's the point of Test-Driven Development?</title><content type='html'>&lt;p&gt;We are now publishing chapters of our book, &lt;a href="http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html"&gt;Growing Object-Oriented Software Guided by Tests&lt;/a&gt; in a separate section of the site. We will publish news about new content in the blog but will not include the entire contents of each chapter as blog posts.&lt;/p&gt;

&lt;p&gt;We have updated Chapter 1, &lt;a href="/book/tdd-introduction.html"&gt;What's the Point of Test-Driven Development?&lt;/a&gt; in response to feedback from blog comments and the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt; and improved some of the diagrams.  More comments are always welcome.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/6456729585893974156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=6456729585893974156' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6456729585893974156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6456729585893974156'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/07/chapter-point-of-test-driven.html' title='Chapter 1. What&apos;s the point of Test-Driven Development?'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-177692450366289973</id><published>2008-07-13T23:49:00.014+01:00</published><updated>2008-08-21T23:02:16.592+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='growing object-oriented software'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Growing Object-Oriented Software, Guided by Tests</title><content type='html'>&lt;p&gt;We have been working for some time on a book about our approach to developing software test-first. We've been working at it long enough that we though it was time to start putting up some material to get some feedback which, after all, is a technique we go on and &lt;i&gt;on&lt;/i&gt; about. We'll start with chapters in HTML, then add some PDFs on the side as the material grows.&lt;/p&gt;
&lt;p&gt;Here's our opening.&lt;/p&gt;

&lt;h3&gt;A Deceptively Simple Idea&lt;/h3&gt;
&lt;blockquote&gt;Test-Driven Development (TDD) is a deceptively simple idea: write the tests for your code before writing the code itself. We say “deceptively simple” because this reversal fundamentally changes the role that testing plays in the development process and challenges the industry's assumptions about what testing is for. Testing is no longer just about keeping defects from the users, instead it's about helping the team to understand the features that the users need and to deliver those features reliably and predictably. When followed to its conclusions, TDD radically changes the way we develop software and, in our experience, dramatically improves the quality of the systems we build, in particular their reliability and their flexibility in response to new requirements. &lt;/blockquote&gt;

&lt;blockquote&gt;Test-Driven Development is widely used in “agile” software development methods. It is a core practice of Extreme Programming (XP) [Beck99], is recommended by Crystal Clear [Cockburn04] and often used in Scrum™ [SB01] projects. If you're going to work on an agile project, you will probably use TDD. We've used TDD on every agile project we've been involved in and have snuck the practises in to non-agile projects. We've even found it useful in pure R&amp;D projects that explore possibilities rather than meet customer needs and so have no need of the customer-facing project management practices of agile methods.&lt;/blockquote&gt;

&lt;h3&gt;More...&lt;/h3&gt;

&lt;p&gt;The &lt;a href="/book/index.html"&gt;Table of Contents&lt;/a&gt; links to the published chapters.&lt;/p&gt;

&lt;h3&gt;Feedback and Discussion&lt;/h3&gt;

&lt;p&gt;If you want to give us feedback on what we've written so far and see what other people think about it, please join the &lt;a href="http://tech.groups.yahoo.com/group/growing-oo-software-guided-by-tests/"&gt;discussion group&lt;/a&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/177692450366289973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=177692450366289973' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/177692450366289973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/177692450366289973'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/07/growing-object-oriented-software-guided.html' title='Growing Object-Oriented Software, Guided by Tests'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-4742962158675255814</id><published>2008-06-05T15:43:00.004+01:00</published><updated>2008-06-05T16:16:08.013+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='training'/><category scheme='http://www.blogger.com/atom/ns#' term='junit4'/><category scheme='http://www.blogger.com/atom/ns#' term='jmock'/><title type='text'>Public training courses?</title><content type='html'>&lt;p&gt;We've had a couple of inquiries about whether we will be running our &lt;a href="http://www.mockobjects.com/2008/05/learn-from-source.html"&gt;training course&lt;/a&gt; publicly. We hadn't planned to, but perhaps we should. We propose to run a two-day course priced at £1100 if booked less than 4 weeks ahead of the teach date, with a discount to £800 if booked earlier (plus UK VAT). The most obvious location is London (UK).&lt;/p&gt;

&lt;p&gt;If you think you might be interested (no commitment implied), please drop us an email at &lt;a href="mailto:public.course@mockobjects.com?subject=Prospective Course&amp;body=Name:%0ALondon is acceptable:%0APreferred other location:%0APreferred month for teach date:%0APossible number of attendees:%0ACoding experience (years):%0ATDD experience (years):%0AContact email:%0AContact phone:"&gt;public.course@mockobjects.com&lt;/a&gt; with this information:&lt;/p&gt;

&lt;pre&gt;
Name: 
London is acceptable:
Preferred other location:
Preferred month for teach date:
Possible number of attendees:
Coding experience (years): 
TDD experience (years):
Contact email:
Contact phone:
&lt;/pre&gt;

&lt;p&gt;We'll see if we can work something out&lt;/p&gt;

&lt;p style="font-size: 0.8em;"&gt;In case you're feeling nervous, whatever details we receive will be used only by us just to coordinate a course. We won't hassle you or pass them on to anyone else.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/4742962158675255814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=4742962158675255814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/4742962158675255814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/4742962158675255814'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/06/public-training-courses.html' title='Public training courses?'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-5676539118854047395</id><published>2008-05-30T10:47:00.007+01:00</published><updated>2008-05-30T11:15:45.913+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='talk'/><title type='text'>Talk at London Geek Night.</title><content type='html'>&lt;p&gt;Nat and I gave a talk at the most recent &lt;a href="http://londongeeknights.wetpaint.com/page/Mocking+with+Java+Night"&gt;London Geek Night&lt;/a&gt;. It was an introduction to our approach to Test-Driven Development, incidentally making the point that some of the state- vs. interaction-based TDD wars are a bit specious; it's a matter of picking the right tool for the job. We had a good crowd and some useful questions. Afterwards, there was a Code Dojo in which Nat took part while I got stuck at the back talking to people. Thanks again to our hosts for an interesting evening.&lt;/p&gt;

&lt;p&gt;We've uploaded the &lt;a href="/files/talk-geeknight-2008.pdf"&gt;slides with notes&lt;/a&gt;. The format's a little odd because we used the toolchain we use for our &lt;a href="http://www.mockobjects.com/2008/05/learn-from-source.html"&gt;courses&lt;/a&gt;, but the material's all there.&lt;/p&gt;

&lt;p&gt;There are couple of other relevant links. Nils Haugen has a nice talk he did on &lt;a href="http://www4.java.no/presentations/javazone/2007/slides/5262.pdf"&gt;Improving Test Maintainability&lt;/a&gt;, which is about making sure the tests make sense. Our interest is more in the stage after that, which is about listening to &lt;a href="http://www.mockobjects.com/labels/listening%20to%20the%20tests.html"&gt;what the tests are telling you&lt;/a&gt; about the design of your code.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/5676539118854047395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=5676539118854047395' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5676539118854047395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5676539118854047395'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/05/talk-at-london-geek-night.html' title='Talk at London Geek Night.'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-6915536228811279767</id><published>2008-05-23T17:37:00.006+01:00</published><updated>2008-06-05T15:42:47.951+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='training'/><category scheme='http://www.blogger.com/atom/ns#' term='junit4'/><category scheme='http://www.blogger.com/atom/ns#' term='jmock'/><title type='text'>Learn from the source!</title><content type='html'>&lt;p&gt;Nat, &lt;a href="http://www.cocking.co.uk/blog/"&gt;Romilly Cocking&lt;/a&gt;, and I are now open for business for training. We have a course on &lt;span style="font-weight:bold;"&gt;Test-Driven Development&lt;/span&gt; that reflects nearly a decade of experience writing tests first (that's 30 years in parallel). We also have significant experience in training, Romilly has a couple of decades on his own, and Nat and I have taught commercially and at two of the top CS departments in the country.&lt;/p&gt;

&lt;p&gt;The course teaches the practice of Test-Driven Development, based on a solid understanding of Object-Oriented design, and with a strong emphasis on making tests expressive and maintainable. We also make a point of exploring how unit tests can be used to &lt;span style="font-style:italic;"&gt;drive&lt;/span&gt; the design of the code, not just protect it.&lt;/p&gt;

&lt;p&gt;The content is modular, so we can adjust it to match the needs of the participants. The full-length course is three busy days, and we've taught versions that are a half-day and whole-day long.&lt;/p&gt;

&lt;p&gt;We teach the course using &lt;a href="http://sourceforge.net/projects/junit"&gt;jUnit4&lt;/a&gt;, &lt;a href="http://code.google.com/p/hamcrest/"&gt;Hamcrest&lt;/a&gt;, and (of course) &lt;a href="http://www.jmock.org"&gt;jMock2&lt;/a&gt;. Talk to us if you want something different.&lt;/p&gt;

&lt;p&gt;For more information, contact us at: &lt;span style="font-weight:bold;"&gt;training@mockobjects.com&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Here's what some attendees liked about the course:&lt;/p&gt;
&lt;blockquote&gt;&amp;ldquo;The practical exposure to a better way of testing&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Practical lab work, real-world concrete examples, Expert lecturers!&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Chance to make mistakes and learn. Exposure to new technology.&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;A very good whole picture view of TDD and mocks&amp;rdquo;&lt;/blockquote&gt;
&lt;blockquote&gt;&amp;ldquo;Interaction and explanation of course materials particularly through the exercises.&amp;rdquo;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/6915536228811279767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=6915536228811279767' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6915536228811279767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6915536228811279767'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/05/learn-from-source.html' title='Learn from the source!'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-2597209967263939177</id><published>2008-03-08T09:52:00.003Z</published><updated>2008-03-08T11:24:30.404Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='ide'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='testability'/><title type='text'>Another round in the testability debate</title><content type='html'>&lt;p&gt;This time a &lt;a href="http://blogs.msdn.com/ploeh/default.aspx"&gt;posting&lt;/a&gt; from Mark Seemann has raised a slew of comments.&lt;/p&gt; 
&lt;p&gt;One of them is a note from Colin Jack about the annoyance of producing interface/implementation pairs all the time. My first response is that that sounds to me a bit like a problem with style. Maybe it's just wordplay, but usually I don't &lt;span style="font-style:italic;"&gt;extract&lt;/span&gt; interfaces from classes, I &lt;span style="font-style:italic;"&gt;implement&lt;/span&gt; interfaces that I've already discovered in some previous test.&lt;/p&gt;

&lt;p&gt;My second response is to wonder how much this is a tools issue. I don't believe there's anything in the .Net world that yet matches the responsiveness of the usual Java IDE's. It makes a difference as to what's plausible. I remember the huge shift in perception when first VisualAge for Java and then JetBrains' Idea came out. In retrospect, I always spent more on time on rework than many people I worked with &lt;sup&gt;1&lt;/sup&gt; but it sure took a lot more time in emacs (and I was pretty good at it), even if I was working in a &lt;a href="http://modula3.org/"&gt;better language&lt;/a&gt;.
&lt;/p&gt;

&lt;hr/&gt;
&lt;p&gt;1) which is not to say who was right, I'm just wired that way...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/2597209967263939177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=2597209967263939177' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2597209967263939177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2597209967263939177'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/03/another-round-in-testability-debate.html' title='Another round in the testability debate'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-2795194424094785701</id><published>2008-02-12T10:03:00.000Z</published><updated>2008-02-12T10:05:11.787Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><title type='text'>New Tutorial at QCon</title><content type='html'>On Tuesday 11th March, at QCon London, &lt;a href="http://www.cocking.co.uk/blog/"&gt;Romilly Cocking &lt;/a&gt;and I will be running a new tutorial we're developing with &lt;a href="http://nat.truemesh.com"&gt;Nat Pryce&lt;/a&gt; on 

&lt;a href="http://qcon.infoq.com/london/presentation/TDD+with+MockObjects"&gt;Test-Driven Development with Mock Objects&lt;/a&gt;

following on from a successful first run at the last XpDay. 

Sign up soon!&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/2795194424094785701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=2795194424094785701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2795194424094785701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/2795194424094785701'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/02/new-tutorial-at-qcon.html' title='New Tutorial at QCon'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-865473193129811678</id><published>2008-01-20T11:57:00.000Z</published><updated>2008-01-20T13:26:11.613Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='testability'/><title type='text'>Just when you thought it was safe to go back in the water...</title><content type='html'>&lt;p&gt;Rising to the bait again (to keep the fishy metaphor going), there's &lt;a href="http://weblogs.asp.net/rosherove/archive/2008/01/18/dependency-injection-is-it-relevant-beyond-unit-testing.aspx"&gt;yet another discussion&lt;/a&gt; of how the ability to hack the runtime changes the world. At one level that's true, but not in this case.&lt;/p&gt;

&lt;p&gt;Dependency Injection is not a recent invention that a cabal of TDDers forced on the world, and it's absolutely not something that we came up with just so we could crowbar in our Mock Objects.&lt;/p&gt;

&lt;p&gt;The relevant design guideline, named the &lt;a href="http://en.wikipedia.org/wiki/Law_of_Demeter"&gt;Law of Demeter&lt;/a&gt; ("Strong Suggestion" isn't very catchy) was first described by Karl Lieberherr in &lt;span style="font-style:italic;"&gt;1987&lt;/span&gt;! The Mock Object pattern came from people applying their substantial O-O experience to TDD in Java, trying to figure out how best to avoid exposing implementation details in unit tests. One of the critical lessons from Demeter is that objects should have explicit dependencies. It helps to keep them focussed on their responsibilities and, as a result, easier to maintain&amp;mdash;and a good way to make dependencies explicit is to pass them in.&lt;/p&gt;

&lt;p&gt;Unfortunately, since then the world seems to have filled up with DI frameworks which cloud what should be a coding style discussion. This is not about having to configure every last corner of your application in XML, this is about how objects, or small clusters of them, get to talk to each other.&lt;/p&gt;

&lt;p&gt;Roy asks, "[...] do you need DI all over the place, or just in specific places where you know dependencies could be a problem?" Well no&amp;mdash;if you have enough foresight to know where those places are. I'm struggling at the moment to test against a framework where everything is helpfully packaged up nice and tight so I can't create an instance of one of its core objects. It's actually well written, but the authors just weren't good enough at prophecy to figure out my particular need. That's why I don't rely just on my intuition, I use the needs of my unit tests to help me figure out where the seams should be. To counter the &lt;a href="http://weblogs.asp.net/rosherove/archive/2008/01/17/is-typemock-too-powerful-will-it-kill-design-for-testability.aspx"&gt;FUD argument&lt;/a&gt;, I have absolutely no problem with saying that I don't want tools that do magic because &lt;span style="font-style:italic;"&gt;I&lt;/span&gt; need guidance with my code.&lt;/p&gt;

&lt;p&gt;As Roy (very politely) concludes, there isn't a high enough proportion of really good code in the world (some of it mine) that we should be in hurry to cut back on techniques such as DI. Just because something has been around for a while doesn't mean it's been superseded, especially in as conventional an environment as .Net.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/865473193129811678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=865473193129811678' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/865473193129811678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/865473193129811678'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/01/just-when-you-thought-it-was-safe-to-go.html' title='Just when you thought it was safe to go back in the water...'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-8901297553364329389</id><published>2008-01-13T09:59:00.001Z</published><updated>2008-01-13T10:21:56.373Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='listening to the tests'/><category scheme='http://www.blogger.com/atom/ns#' term='testability'/><title type='text'>Avoid mega unit tests</title><content type='html'>&lt;p&gt;We've just had a posting to the jMock user list that included the following:&lt;/p&gt;

&lt;blockquote&gt;I was involved in a project recently where JMock was used quite heavily. Looking back, here's what I found:

&lt;ol&gt;
&lt;li&gt;The unit tests where at times unreadable (no idea what they were doing).&lt;/li&gt;
&lt;li&gt;Some tests classes would reach 500 lines in addition to inheriting an
abstract class which also would have up to 500 lines.&lt;/li&gt;
&lt;li&gt;Refactoring would lead to massive changes in test code.&lt;/li&gt;
&lt;/ol&gt;&lt;/blockquote&gt;

&lt;p&gt;I've seen this failure mode on another project I've been helping with, so I think there might be a common pattern.&lt;/p&gt;

&lt;p&gt;I don't think any &lt;i&gt;unit&lt;/i&gt; test code should get that large, except for unusual circumstances. Unit tests are supposed to focus on at most a few classes and shouldn't need a large amount of set up.  What I saw on the other project was enormous amounts of preparation and positioning to get the objects into a state where the expected feature could be exercised. Of course it's hard to understand the point of a test when there's just so much code. If you see this pattern, then I'd suggest that the code (or at least the test code) needs breaking up a bit. On the other hand, &lt;i&gt;integration&lt;/i&gt; and &lt;i&gt;acceptance&lt;/i&gt; tests that happen to be written using a unit test framework might well be larger.&lt;/p&gt;

&lt;p&gt;One thing I need to explore is whether the naive use of interaction-testing is particularly susceptible to this failing, or whether it happens all the time and we're the only ones who get complained to. I am, however, convinced that the emphasis on mainly using Mocks to substitute external systems (some of which I perpetrated myself in the early days) is a deeply bad idea which pushes teams towards the sort of problem described here.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/8901297553364329389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=8901297553364329389' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8901297553364329389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8901297553364329389'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2008/01/avoid-mega-unit-tests.html' title='Avoid mega unit tests'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-6553568752542339527</id><published>2007-12-22T14:13:00.000Z</published><updated>2007-12-22T14:17:02.261Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='news projects'/><title type='text'>Mock objects for Java ME</title><content type='html'>Carl Meijer has asked us to announce his new project...

&lt;blockquote&gt;Yesterday I uploaded a personal project, Hammock, to sourceforge
(&lt;a href="http://sourceforge.net/projects/hammockmocks"&gt;http://sourceforge.net/projects/hammockmocks&lt;/a&gt;).  This a mock object framework for Java ME. Java ME, unfortunately, doesn't support reflection making jMock, EasyMock, etc. unsuitable for use on a mobile device or emulator.  Obviously this makes creating mocks more difficult than with the Java SE mock object frameworks but the distribution includes a utility, HammockMaker, for creating the source for a mock object given a class file (of a non-final class or of an interface).  The framework includes mocks of many of the standard Java ME classes for communications such as HTTP, SMS, OBEX, etc so that one can test without actually hitting a network.  I've used it on three projects at my current employer.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/6553568752542339527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=6553568752542339527' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6553568752542339527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/6553568752542339527'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/12/mock-objects-for-java-me.html' title='Mock objects for Java ME'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-5845619993424176578</id><published>2007-12-04T11:33:00.000Z</published><updated>2007-12-10T14:00:24.242Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Don't tie down your code, use interfaces</title><content type='html'>&lt;img src="http://www.mockobjects.com/uploaded_images/gulliver.jpeg" alt="Gulliver" style="margin: 0pt 0pt 10px 10px; float: right;" /&gt;
&lt;p&gt;Recently, I was responding to a question on the TDD list and found myself writing this:&lt;/p&gt;
&lt;blockquote&gt;Although there's only one use of the interface, you could think of it as a way of keeping a clean distinction between the naming of different domains (user and persistence). It makes managing package dependencies easier too.&lt;/blockquote&gt;
&lt;p&gt;which is what I've been meaning to say for ages. The reason we're keen on &lt;a href="http://www.mockobjects.com/files/mockrolesnotobjects.pdf"&gt;discovering interfaces&lt;/a&gt; in our code is that we think they're a good way of expressing concepts in a domain.
&lt;/p&gt;
&lt;p&gt;If I'm writing a ring tones store (the video store folded last year) and I need to look up, say, the customers that were active last month, I'll ask a &lt;tt&gt;SalesLedger&lt;/tt&gt; object. So, what type is &lt;tt&gt;SalesLedger&lt;/tt&gt;? If it's a class then my marketing module will have a dependency on whatever persistence framework I use. If my &lt;tt&gt;SalesLedger&lt;/tt&gt; class is clean and delegates to some further persistence type then I've only deferred the problem. I'm importing, directly or indirectly, the persistence packages into my domain code. If I do the same with a few other frameworks (printing, display, network, etc.) then I'll have tied down my domain module with third party dependencies. The module dependency chain looks like this:&lt;/p&gt;

&lt;img src="http://www.mockobjects.com/uploaded_images/class_dependency.png" alt="Class Dependency"/&gt;

&lt;p&gt;There are two problems with this, one obvious and one subtle. The obvious point is that I've raised the risk of inflexible code. One day I'll have to rip out a messy chain of dependencies to get to some code I want to change. Now, because I'm another &lt;a href="http://parlezuml.com/blog/?postid=520"&gt;World's Greatest Software Developer&lt;/a&gt;, I'll be careful not to embed the dependency too deeply and keep my packages clean and layered, but that's  intellectual overhead I could do without. When &lt;tt&gt;SalesLedger&lt;/tt&gt; is an interface, I have a clear distinctions between the domains of marketing and persistence, and I &lt;span style="font-style: italic;"&gt;cannot&lt;/span&gt; let the abstractions leak through. If I do this for all my external dependencies, I can package up my domain code and use it in all sorts of ways I haven't thought of yet. The top-level Application then becomes a matchmaker, introducing all the modules to each other and helping them get started.&lt;/p&gt;

&lt;img src="http://www.mockobjects.com/uploaded_images/interface_dependency.png" alt="Class Dependency"/&gt;

&lt;p&gt;The more subtle issue is that &lt;tt&gt;SalesLedger&lt;/tt&gt;, the interface I use in the body of my code, is in a different domain from the &lt;tt&gt;HibernateLedger&lt;/tt&gt;, a class that implements it (and maybe some other interfaces). The code that uses a &lt;tt&gt;SalesLedger&lt;/tt&gt; is concerned with marketing and payments, the code that uses a &lt;tt&gt;HibernateLedger&lt;/tt&gt; is concerned with setting up connections. There may only be one implementation of an interface, but the two types are addressing different things.&lt;/p&gt;
&lt;p&gt;Is this breaking YAGNI? I don't think so (although there are others that do). I'm not adding features I haven't identified a need for yet. Part of the deal with YAGNI is that I make the code as expressive of my current intentions as I can, and I think I'm expressing the needs of the domain code needs more clearly by limiting its dependency to an interface that defines just the services it needs from other parts of the system.&lt;/p&gt;

&lt;hr /&gt;
&lt;span style="font-size:0;"&gt;n.b. Gulliver image taken from &lt;a href="http://news.bbc.co.uk/1/hi/business/2676711.stm"&gt;news.bbc.co.uk&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/5845619993424176578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=5845619993424176578' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5845619993424176578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5845619993424176578'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/12/interfaces-blindingly-obvious.html' title='Don&apos;t tie down your code, use interfaces'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-3430090147438007673</id><published>2007-11-21T14:46:00.001Z</published><updated>2007-11-21T14:48:05.611Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><title type='text'>MockObjects in Bangalore</title><content type='html'>&lt;p&gt;I'll be presenting a tutorial/workshop/Dojo on TDD with Mock Objects at &lt;a href="http://agileindia.org/stevefreemanonmockobjects"&gt;Agile India in Bangalore&lt;/a&gt; this Sunday. I hope the locals will find the material interesting (and that they give me an easy ride while I struggle with the jet lag :).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/3430090147438007673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=3430090147438007673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3430090147438007673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3430090147438007673'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/11/mockobjects-in-bangalore.html' title='MockObjects in Bangalore'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-3432632496036002049</id><published>2007-10-19T10:19:00.000+01:00</published><updated>2007-10-19T10:28:57.505+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mocks in action'/><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='specification'/><title type='text'>"Testing towards A Specification: A Systematic Approach"</title><content type='html'>&lt;p&gt;Peter Dimov has published his &lt;a href="http://bzr.calitko.org/developers/peter/MasterThesis.pdf"&gt;Master's thesis&lt;/a&gt;. To quote him:&lt;/p&gt;

&lt;blockquote&gt;It is based on Test Driven Development with Mock Objects, hence the focus is on interaction-based testing. I'm introducing the mocking framework CalitkoMocks, which is specially designed to provide a notation for writing tests that can be mapped one-to-one to sequence diagrams. Sequence diagrams are classically used to specify object-oriented software systems, however, it is obvious that just a bunch of diagrams representing individual cases cannot really be regarded as a specification. To address this point, I'm also presenting a few test refactorings which help to extract test scenarios (i.e. generalized test cases), which are more suitable to use as a specification.&lt;/blockquote&gt;

&lt;p&gt;He's implemented a mock framework for C++ that's part of &lt;a href="http://www.calitko.org"&gt;Calitko&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I especially liked his closing remark&lt;/p&gt;

&lt;blockquote&gt;After I drew the diagram corresponding to my test, I decided to try to write a test  corresponding one-to-one to the sequence diagram. The sequence diagram showed the calls to my stub objects but my test didn’t (because the implementation invoked them implicitly). I ended up writing smarter versions of my stubs which eventually evolved into mocks. Though I had already read about mocks at that time, I didn’t quite get it what kind of beasts these were. It was only after I reinvented the mock that I truly understood the concept.&lt;/blockquote&gt;


&lt;p&gt;Perhaps this is a step on the way to addressing &lt;a href="http://www.parlezuml.com/"&gt;Jason Gorman&lt;/a&gt;'s &lt;a href="https://www.blogger.com/comment.g?blogID=34908752&amp;postID=9150604897582101414"&gt;concerns&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/3432632496036002049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=3432632496036002049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3432632496036002049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/3432632496036002049'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/10/testing-towards-specification.html' title='&quot;Testing towards A Specification: A Systematic Approach&quot;'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-5406659771418390835</id><published>2007-10-16T13:29:00.000+01:00</published><updated>2007-10-20T09:07:22.067+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='jmock'/><title type='text'>XpDay London 19/20 November</title><content type='html'>We have a couple of sessions at &lt;a href="http://www.xpday.org"&gt;XpDay London&lt;/a&gt;.

Steve will be giving our Synaesthesia talk on Monday. On Tuesday, Nat, with Romily Cocking, Andy Pols, and Steve (part-time) will be giving an introductory tutorial on TDD with Mocks.

Book soon!&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/5406659771418390835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=5406659771418390835' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5406659771418390835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/5406659771418390835'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/10/xpday-london-1920-october.html' title='XpDay London 19/20 November'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-8037651768494099815</id><published>2007-10-13T11:13:00.000+01:00</published><updated>2007-10-13T11:39:17.685+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mocks in action'/><category scheme='http://www.blogger.com/atom/ns#' term='pictures'/><title type='text'>Mock Throwable</title><content type='html'>&lt;a href="http://www.mockobjects.com/uploaded_images/mock_throwable-774330.jpeg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://www.mockobjects.com/uploaded_images/mock_throwable-774325.jpeg" border="0" alt="" /&gt;&lt;/a&gt;

Yesterday I visited a team at a &lt;a href="http://cyrusinnovation.com/"&gt;Cyrus Innovation&lt;/a&gt; site. They came up with this example. If you can't read it, the writing on the ball says "Throwable". Cute.&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/8037651768494099815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=8037651768494099815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8037651768494099815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8037651768494099815'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/10/mock-throwable.html' title='Mock Throwable'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry><entry><id>tag:blogger.com,1999:blog-34908752.post-8839958108970788937</id><published>2007-10-02T00:14:00.000+01:00</published><updated>2007-10-06T16:40:59.652+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='by the way'/><title type='text'>Blogger in German?</title><content type='html'>On a side note, this blog is "powered by Blogger" and I keep getting bits of the UI text in German. Does anyone have any idea what's happening?&lt;div class="blogger-post-footer"&gt;&lt;a href="http://technorati.com/claim/e3dy57vh3k" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/8839958108970788937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=34908752&amp;postID=8839958108970788937' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8839958108970788937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34908752/posts/default/8839958108970788937'/><link rel='alternate' type='text/html' href='http://www.mockobjects.com/2007/10/blogger-in-german.html' title='Blogger in German?'/><author><name>Steve Freeman</name><uri>http://www.blogger.com/profile/14771999065792016571</uri><email>noreply@blogger.com</email></author></entry></feed>