<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>.net and other musings &#187; DDD</title>
	<atom:link href="http://benl.wordpress.com/category/ddd/feed/" rel="self" type="application/rss+xml" />
	<link>http://benl.wordpress.com</link>
	<description>Ben Lovell, an agile developer living in the UK.</description>
	<lastBuildDate>Thu, 16 Jul 2009 09:43:48 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='benl.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/43c6fe283d98c1764e951cd6dfface61?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>.net and other musings &#187; DDD</title>
		<link>http://benl.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://benl.wordpress.com/osd.xml" title=".net and other musings" />
		<item>
		<title>Incremental development with Monorail: Part Five</title>
		<link>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/</link>
		<comments>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 20:20:29 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>
		<category><![CDATA[Windsor]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/</guid>
		<description><![CDATA[Welcome back. In this post I&#8217;ll be getting our tests passing again and cleaning things up a little. We left off with a failing integration test:
 
I suspect this is due to the IBlogPostMapper dependency we introduced to our BlogPostService not being handled by the container. If we run in the browser we can confirm [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=338&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Welcome back. In this post I&#8217;ll be getting our tests passing again and cleaning things up a little. We left off with a failing integration test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/421.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="42" src="http://benl.files.wordpress.com/2008/04/42-thumb1.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p>I suspect this is due to the <strong>IBlogPostMapper </strong>dependency we introduced to our <strong>BlogPostService </strong>not being handled by the container. If we run in the browser we can confirm this is in fact true:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="315" alt="" src="http://benl.files.wordpress.com/2008/04/thumb.png?w=504&#038;h=315" width="504" border="0"></a> </p>
<p>As we&#8217;ve yet to implement our <strong>IBlogPostMapper </strong>we must go ahead and do this before we can add the container configuration to pass our integration test. Lets bust out a test and get things rolling:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/43.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="462" alt="43" src="http://benl.files.wordpress.com/2008/04/43-thumb.png?w=508&#038;h=462" width="508" border="0"></a> </p>
<p>We have a few blanks to fill in in order to get this to compile and run:</p>
<ol>
<li>Make the DTO&#8217;s properties virtual so we can mock them. This is in preference to extracting an interface<strong>. </strong></li>
<li>Implement <strong>IBlogPostMapper</strong>.</li>
<li>Add the necessary properties to the <strong>IBlogPost </strong>interface.</li>
</ol>
<p>Lets go ahead and do this now:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/44.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="438" alt="44" src="http://benl.files.wordpress.com/2008/04/44-thumb.png?w=508&#038;h=438" width="508" border="0"></a></p>
<p><strong>IBlogPostMapper </strong>minimal implementation:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/45.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="162" alt="45" src="http://benl.files.wordpress.com/2008/04/45-thumb.png?w=508&#038;h=162" width="508" border="0"></a>&nbsp; </p>
<p>The necessary modifications to <strong>IBlogPost</strong>:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/46.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="167" alt="46" src="http://benl.files.wordpress.com/2008/04/46-thumb.png?w=508&#038;h=167" width="508" border="0"></a> </p>
<p>Now we can compile and run our test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/47.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="95" alt="47" src="http://benl.files.wordpress.com/2008/04/47-thumb.png?w=508&#038;h=95" width="508" border="0"></a> </p>
<p>Our <strong>BlogPostMapper </strong>implementation is throwing an exception so lets go back and take another step to try and pass our test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/48.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="133" alt="48" src="http://benl.files.wordpress.com/2008/04/48-thumb.png?w=508&#038;h=133" width="508" border="0"></a> </p>
<p><strong>BlogPost</strong>:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/49.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="418" alt="49" src="http://benl.files.wordpress.com/2008/04/49-thumb.png?w=508&#038;h=418" width="508" border="0"></a> </p>
<p>I&#8217;m pretty certain we&#8217;ve done enough to pass our test now. Lets have a go:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/50.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="38" alt="50" src="http://benl.files.wordpress.com/2008/04/50-thumb.png?w=508&#038;h=38" width="508" border="0"></a> </p>
<p>OK now lets focus on the full suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/51.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="129" alt="51" src="http://benl.files.wordpress.com/2008/04/51-thumb.png?w=508&#038;h=129" width="508" border="0"></a> </p>
<p>Our integration test is still bombing but as we&#8217;ve got a mapper now, we can go ahead and wire up our Windsor configuration and get things moving again:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/52.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="84" alt="52" src="http://benl.files.wordpress.com/2008/04/52-thumb.png?w=508&#038;h=84" width="508" border="0"></a> </p>
<p>We&#8217;ve added another configuration file: <strong>mapper.config</strong> and referenced this from the <strong>web.config</strong>. We shouldn&#8217;t need to do any more than this so lets run our full test suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/53.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="28" alt="53" src="http://benl.files.wordpress.com/2008/04/53-thumb.png?w=508&#038;h=28" width="508" border="0"></a> </p>
<p>Our full suite is passing now. Not bad for 5 minutes work! As usual the latest changes are checked in to the <a href="http://code.google.com/p/mr-blogengine/" target="_blank">Google code project hosted here.</a></p>
<p>Now we have a full passing suite, in our next edition I&#8217;ll be moving down into the persistence and also incorporating a <a href="http://hammett.castleproject.org/?p=280" target="_blank">few modifications from Hammett</a>. Stay tuned!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/338/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/338/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/338/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=338&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/42-thumb1.png" medium="image">
			<media:title type="html">42</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/thumb.png" medium="image" />

		<media:content url="http://benl.files.wordpress.com/2008/04/43-thumb.png" medium="image">
			<media:title type="html">43</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/44-thumb.png" medium="image">
			<media:title type="html">44</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/45-thumb.png" medium="image">
			<media:title type="html">45</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/46-thumb.png" medium="image">
			<media:title type="html">46</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/47-thumb.png" medium="image">
			<media:title type="html">47</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/48-thumb.png" medium="image">
			<media:title type="html">48</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/49-thumb.png" medium="image">
			<media:title type="html">49</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/50-thumb.png" medium="image">
			<media:title type="html">50</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/51-thumb.png" medium="image">
			<media:title type="html">51</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/52-thumb.png" medium="image">
			<media:title type="html">52</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/53-thumb.png" medium="image">
			<media:title type="html">53</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Four</title>
		<link>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/</link>
		<comments>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 19:35:28 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/</guid>
		<description><![CDATA[We finished up in the last instalment by moving down a layer into our newly introduced BlogPostService. Our tests are passing yet our application is still pretty lacking in the actual functionality department. To move things on a stage further we need to: 

Map from the AddPostRequestDto to our actual BlogPost aggregate root.
Validate the BlogPost.
Persist [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=311&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We finished up in the last instalment by moving down a layer into our newly introduced <strong>BlogPostService. </strong>Our tests are passing yet our application is still pretty lacking in the actual functionality department. To move things on a stage further we need to: </p>
<ol>
<li>Map from the <strong>AddPostRequestDto </strong>to our actual <strong>BlogPost </strong>aggregate root.
<li>Validate the <strong>BlogPost.</strong>
<li>Persist our new <strong>BlogPost</strong>.</li>
</ol>
<p>We need to write another test to flesh out the interaction between our service and something that can map from the DTO to our <strong>BlogPost:</strong></p>
<p><a href="http://benl.files.wordpress.com/2008/04/37.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="238" alt="37" src="http://benl.files.wordpress.com/2008/04/37-thumb.png?w=508&#038;h=238" width="508" border="0"></a> </p>
<p>We&#8217;re now expecting the <strong>BlogPostService</strong> to accept the mapper in its constructor, and defining an interaction between the service and the mapper. Before we can get this to compile we need to make a few more changes to our test fixture:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/371.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="508" alt="37" src="http://benl.files.wordpress.com/2008/04/37-thumb1.png?w=508&#038;h=508" width="508" border="0"></a> </p>
<p>We&#8217;ve modified an existing test to allow for our new dependency and performed some setup tasks. We&#8217;ve introduced the <strong>IBlogPostMapper </strong>and <strong>IBlogPost </strong>interfaces by way of our test. Running the test causes the compiler to choke so lets go ahead and implement what we need to pass the tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/38.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="133" alt="38" src="http://benl.files.wordpress.com/2008/04/38-thumb.png?w=508&#038;h=133" width="508" border="0"></a> </p>
<p><a href="http://benl.files.wordpress.com/2008/04/39.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="39" src="http://benl.files.wordpress.com/2008/04/39-thumb.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p><a href="http://benl.files.wordpress.com/2008/04/40.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="250" alt="40" src="http://benl.files.wordpress.com/2008/04/40-thumb.png?w=508&#038;h=250" width="508" border="0"></a> </p>
<p>Lets go ahead and run our <strong>BlogPostServiceFixture </strong>tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/41.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="43" alt="41" src="http://benl.files.wordpress.com/2008/04/41-thumb.png?w=508&#038;h=43" width="508" border="0"></a> </p>
<p>Righteo, that went well. For the sake of completeness lets run our full test suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/42.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="42" src="http://benl.files.wordpress.com/2008/04/42-thumb.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p>The integration test is failing as we&#8217;ve yet to wire up the <strong>BlogPostService </strong>dependencies in the container. Before we can do this we need to drive out the interfaces we&#8217;ve introduced. We&#8217;ll do that in the next post.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/311/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/311/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=311&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/37-thumb.png" medium="image">
			<media:title type="html">37</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/37-thumb1.png" medium="image">
			<media:title type="html">37</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/38-thumb.png" medium="image">
			<media:title type="html">38</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/39-thumb.png" medium="image">
			<media:title type="html">39</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/40-thumb.png" medium="image">
			<media:title type="html">40</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/41-thumb.png" medium="image">
			<media:title type="html">41</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/42-thumb.png" medium="image">
			<media:title type="html">42</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Three</title>
		<link>http://benl.wordpress.com/2008/04/01/incremental-development-with-monorail-part-three/</link>
		<comments>http://benl.wordpress.com/2008/04/01/incremental-development-with-monorail-part-three/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 16:49:13 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/01/incremental-development-with-monorail-part-three/</guid>
		<description><![CDATA[Part OnePart Two
In the last instalment we finished up with a suite of passing tests. However, we&#8217;ve yet to produce anything remotely usable so lets continue by reaching down further and driving out our services/persistence. We&#8217;ll start by writing the following test:
 
We&#8217;ve meddled with our test setup a little to introduce the MockRepository for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=296&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail/">Part One</a><br /><a href="http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail-part-two/">Part Two</a></p>
<p>In the last instalment we finished up with a suite of passing tests. However, we&#8217;ve yet to produce anything remotely usable so lets continue by reaching down further and driving out our services/persistence. We&#8217;ll start by writing the following test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/23.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="478" alt="23" src="http://benl.files.wordpress.com/2008/04/23-thumb.png?w=508&#038;h=478" width="508" border="0"></a> </p>
<p>We&#8217;ve meddled with our test setup a little to introduce the <strong>MockRepository </strong>for mocking out our <strong>PostController&#8217;s</strong> new dependency on the <strong>IBlogPostService. </strong>Our test now calls the <strong>AddPost </strong>method on our service interface and sets up the resulting <strong>AddPostResponseDto</strong>. Running the test produces a bunch of compiler whinging so we best implement the newly introduced bits:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/24.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="99" alt="24" src="http://benl.files.wordpress.com/2008/04/24-thumb.png?w=508&#038;h=99" width="508" border="0"></a></p>
<p><a href="http://benl.files.wordpress.com/2008/04/25.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="309" alt="25" src="http://benl.files.wordpress.com/2008/04/25-thumb.png?w=508&#038;h=309" width="508" border="0"></a>&nbsp; </p>
<p><a href="http://benl.files.wordpress.com/2008/04/26.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="181" alt="26" src="http://benl.files.wordpress.com/2008/04/26-thumb.png?w=508&#038;h=181" width="508" border="0"></a> </p>
<p>These are the only changes and additions we&#8217;ve made in order for the tests to compile and run. Running our test now produces the following result:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/27.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="27" alt="27" src="http://benl.files.wordpress.com/2008/04/27-thumb.png?w=508&#038;h=27" width="508" border="0"></a> </p>
<p>As we&#8217;ve yet to modify the <strong>PostController.Save(&#8230;) </strong>call to include a call the newly introduced <strong>IBlogPostService </strong>dependency. Lets go ahead and do this now:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/28.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="144" alt="28" src="http://benl.files.wordpress.com/2008/04/28-thumb.png?w=508&#038;h=144" width="508" border="0"></a> </p>
<p>We&#8217;ve now included the call to our newly introduced service and we set the <strong>responseMessage </strong>if the response is signaled as successful. Lets run our test now:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/29.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="24" alt="29" src="http://benl.files.wordpress.com/2008/04/29-thumb.png?w=495&#038;h=24" width="495" border="0"></a> </p>
<p>It works, ship it! Actually no, again we&#8217;re pretty low on <em>actual </em>functionality right now. Remember we&#8217;ve yet to actually drive out any implementation of the <strong>IBlogPostService </strong>interface as yet and I expect that the acceptance test will fail horribly since we didn&#8217;t wire up the necessary container configuration either. Lets go ahead and run the whole test suite and see what gives:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/30.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="132" alt="30" src="http://benl.files.wordpress.com/2008/04/30-thumb.png?w=508&#038;h=132" width="508" border="0"></a> </p>
<p>In the brief moments the browser appears during the test we can see the following:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/31.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="407" alt="31" src="http://benl.files.wordpress.com/2008/04/31-thumb.png?w=508&#038;h=407" width="508" border="0"></a> </p>
<p>Hmm, as I predicted earlier our application fails to run due to the lack of proper container configuration. Before we can do this we need to implement the <strong>IBlogPostService </strong>interface somewhere. We need to write a failing test to begin our foray into the implementation of a <strong>BlogPostService</strong>:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/32.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="124" alt="32" src="http://benl.files.wordpress.com/2008/04/32-thumb.png?w=508&#038;h=124" width="508" border="0"></a> </p>
<p>Lets create the <strong>BlogPostService </strong>only performing the steps necessary to pass the test above:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/33.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="184" alt="33" src="http://benl.files.wordpress.com/2008/04/33-thumb.png?w=508&#038;h=184" width="508" border="0"></a> </p>
<p>Run the test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/34.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="19" alt="34" src="http://benl.files.wordpress.com/2008/04/34-thumb.png?w=508&#038;h=19" width="508" border="0"></a> </p>
<p>Now we have a working <strong>BlogPostService </strong>we can now wire up our container configuration to pass the acceptance test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/35.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="86" alt="35" src="http://benl.files.wordpress.com/2008/04/35-thumb.png?w=508&#038;h=86" width="508" border="0"></a> </p>
<p>Now running the full suite of tests produces the following:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/36.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="36" alt="36" src="http://benl.files.wordpress.com/2008/04/36-thumb.png?w=508&#038;h=36" width="508" border="0"></a> </p>
<p>Our tests pass!</p>
<p>That&#8217;s it for this post. I&#8217;ve checked in the latest changes to the repository. In the next post we&#8217;ll continue our efforts and begin to implement validation on our screen-bound DTO&#8217;s.</p>
<p>Google code hosted project: <a title="http://code.google.com/p/mr-blogengine/" href="http://code.google.com/p/mr-blogengine/">http://code.google.com/p/mr-blogengine/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/296/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/296/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=296&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/01/incremental-development-with-monorail-part-three/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/23-thumb.png" medium="image">
			<media:title type="html">23</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/24-thumb.png" medium="image">
			<media:title type="html">24</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/25-thumb.png" medium="image">
			<media:title type="html">25</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/26-thumb.png" medium="image">
			<media:title type="html">26</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/27-thumb.png" medium="image">
			<media:title type="html">27</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/28-thumb.png" medium="image">
			<media:title type="html">28</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/29-thumb.png" medium="image">
			<media:title type="html">29</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/30-thumb.png" medium="image">
			<media:title type="html">30</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/31-thumb.png" medium="image">
			<media:title type="html">31</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/32-thumb.png" medium="image">
			<media:title type="html">32</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/33-thumb.png" medium="image">
			<media:title type="html">33</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/34-thumb.png" medium="image">
			<media:title type="html">34</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/35-thumb.png" medium="image">
			<media:title type="html">35</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/36-thumb.png" medium="image">
			<media:title type="html">36</media:title>
		</media:content>
	</item>
		<item>
		<title>Front-end DTO&#8217;s</title>
		<link>http://benl.wordpress.com/2008/03/11/front-end-dtos/</link>
		<comments>http://benl.wordpress.com/2008/03/11/front-end-dtos/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 14:16:25 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[Monorail]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/03/11/front-end-dtos/</guid>
		<description><![CDATA[An interesting discussion was brought up in one of the ALT.NET groups regarding the use of DTO&#8217;s in the presentation layer that I had to chime in on.
I&#8217;m a strong advocate of message passing from the UI to your services for several reasons:

Test driving from the top-down is my favoured approach when developing web applications. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=146&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>An interesting discussion was brought up in one of the ALT.NET groups regarding the use of DTO&#8217;s in the presentation layer that I had to chime in on.</p>
<p>I&#8217;m a strong advocate of message passing from the UI to your services for several reasons:</p>
<ol>
<li>Test driving from the top-down is my favoured approach when developing web applications. I&#8217;ll start by writing a failing test for my controller (you should know by now I use Monorail <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). Then I&#8217;ll stub out any dependencies, these usually being service interfaces which accept and return simple DTO&#8217;s with absolutely no behaviour. Stubbing out the services allows you to return dummy data very early on in your development. The nice thing about this approach is you can get a working UI together very quickly and then drive out the development of each layer until you hit your domain model. From which point you can then wire-up your real service and repository implementations and satisfy your acceptance tests end-to-end. Now I&#8217;m not suggesting that this approach isn&#8217;t possible without DTO&#8217;s but it makes it a heck lot easier in my experience.</li>
<li>DDD aggregates by their very nature are composed of behaviours you don&#8217;t want to pass into your UI. Using DTO&#8217;s for binding into your UI keeps things nice and lightweight. Cohesion is high as the DTO&#8217;s are created for a very specific purpose, usually to satisfy a particular screen or UI workflow.</li>
<li>I had made the rather nebulous statement that the use of DTO&#8217;s insulates your UI against changes in your domain model. Quite rightly somebody replied saying that this was all relative and there are many means to insulate against change. Of course, I wholeheartedly agree but in my defence I was replying to the OP from my iPhone. Now for me to explain this a little&#8230; Unless you&#8217;re using query projections (a la NHibernate) you&#8217;ll be mapping from your domain entities to specific DTO&#8217;s using some kind of mapper class. Your mapper probably depends on the interfaces of your particular domain entities and the implementation of your DTO&#8217;s. I say <em>implementation</em> as I drive out the mapping using state-based testing, which of course makes perfect sense when mapping from one state to another! Using DTO&#8217;s means our controller has a nice seam between itself and the services through their interfaces thus the controller (read: UI) has no knowledge of the domain model at all. Any changes to the domain model are catered for by changing the mapper specific to the affected messages. I won&#8217;t get into versioning messages, mainly because I haven&#8217;t got the time or inclination <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>I&#8217;ve always thought (and I read this somewhere I think, but can&#8217;t remember where) that a sign of a well designed architecture, among other things of course, is the ability to replace the UI and have everything function correctly. Now it was probably more poetic than that but essentially what this means is your UI should have absolutely zero dependencies on anything below your service interfaces. Using DTO&#8217;s and message passing means the only work your controllers are doing is scraping the request, passing your message to a service and binding the response. I&#8217;ve demonstrated this in systems I&#8217;ve developed by providing an API (which can be considered another UI if you squint a little and look sideways) which is comprised of exactly the same service calls and DTO&#8217;s my web UI is using.</li>
<li>My last point isn&#8217;t specifically tied to the use of DTO&#8217;s but more based around messaging architecture in general&#8230; What this gives me from the very beginning (i.e. the first test) is a nice basis for distributing my architecture. Our services can be hosted on an application server separately from our web application&nbsp; or preferably located transparently via a message bus which brings in a whole heap of nice side-effects&#8230; </li>
</ol>
<p>So in summary you can see I&#8217;m a big fan of the domain model in my services, mapping to and from DTO&#8217;s in my UI. What is your favoured approach?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/146/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/146/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=146&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/03/11/front-end-dtos/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>
	</item>
		<item>
		<title>Improving Applications Design with a Rich Domain Model</title>
		<link>http://benl.wordpress.com/2007/08/31/improving-applications-design-with-a-rich-domain-model/</link>
		<comments>http://benl.wordpress.com/2007/08/31/improving-applications-design-with-a-rich-domain-model/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 15:21:00 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[DDD]]></category>
		<category><![CDATA[Domain Driven Design]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2007/08/31/improving-applications-design-with-a-rich-domain-model/</guid>
		<description><![CDATA[Take a look at this talk on DDD given during Spring 2007 by Chris Richardson&#160;for a heads-up. Its probably the most concise I&#8217;ve seen on the topic so far.
Have a look.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=110&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Take a look at this talk on DDD given during Spring 2007 by Chris Richardson&nbsp;for a heads-up. Its probably the most concise I&#8217;ve seen on the topic so far.</p>
<p><a href="http://www.parleys.com/display/PARLEYS/Improving+Application+Design+with+a+Rich+Domain+Model?showComments=true" target="_blank">Have a look</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/110/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/110/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=110&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2007/08/31/improving-applications-design-with-a-rich-domain-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>
	</item>
	</channel>
</rss>