<?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/"
	>

<channel>
	<title>toniBlog &#187; DDD</title>
	<atom:link href="http://www.the-arm.com/tag/DDD/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-arm.com</link>
	<description>A weblog about Methodologies for Development</description>
	<lastBuildDate>Mon, 01 Mar 2010 07:22:39 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Domain Driven in the financial world (II)</title>
		<link>http://www.the-arm.com/2008/06/domain-driven-in-the-financial-world-ii/</link>
		<comments>http://www.the-arm.com/2008/06/domain-driven-in-the-financial-world-ii/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 03:26:55 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[DDD]]></category>
		<category><![CDATA[financial]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/06/17/domain-driven-in-the-financial-world-ii/</guid>
		<description><![CDATA[Josh was right on his comment on my previous post about DDD in the financial world: we had a new requirement from the client: design a market simulator.
Basically our market simulator is a tool to parse the production logs, inject them into the application and verify that the behaviour of the application is correct. (A [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://grahamis.com/blog/">Josh</a> was right on his <a href="http://blog.java2me.org/2008/04/19/domain-driven-in-the-financial-world/#comment-9092">comment</a> on my <a href="http://blog.java2me.org/2008/04/19/domain-driven-in-the-financial-world/">previous post</a> about DDD in the financial world: we had a new requirement from the client: design a market simulator.</p>
<p>Basically our market simulator is a tool to parse the production logs, inject them into the application and verify that the behaviour of the application is correct. (A commercial tool called <a href="http://www.greenlinetech.com/products/verifix.php">VeriFIX</a> does more or less the same job, but we need more flexibility)</p>
<p>It will be used when upgrading to newer releases and when installing a new instance of the Fix Routing Engine.<br />
It is end to end black box testing, with some reports to understand if everything is still processed by the Fix engine as it&#8217;s supposed to be.</p>
<p>From a new joiner on the Fix support team we had the request to show in the reports not the tag values for the processed fix messages but the description and (not a surprise) even a senior developer of the client was asking the same feature.</p>
<p>Looking then to the full picture we are always playing with the same object, the famous Fix message, with his near to 1000 fields but we use friendly tag descriptions on tests and code, tag numbers on the DSL: concise and quicker to understand by the Fix team and finally again tag descriptions for the Fix support team in the test reports. 
</p>
<p>
Every context has its own language, even inside the same division, even in the same domain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/06/domain-driven-in-the-financial-world-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domain Driven in the financial world</title>
		<link>http://www.the-arm.com/2008/04/domain-driven-in-the-financial-world/</link>
		<comments>http://www.the-arm.com/2008/04/domain-driven-in-the-financial-world/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 03:48:48 +0000</pubDate>
		<dc:creator>vjsoft57</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[financial]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/04/19/domain-driven-in-the-financial-world/</guid>
		<description><![CDATA[Domain Driven Design promotes the usage of an Ubiquitous Language, in a line, we should all speak the same language, from developers to domain experts. 
So it happened that the project were I am it&#8217;s a financial one: FiX messages routing&#8230; 
There&#8217;s always an on boarding time, a learning curve with a new domain&#8230;
But here [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.domainlanguage.com/about/ericevans.html">Domain Driven Design</a> promotes the usage of an Ubiquitous Language, in a line, we should all speak the same language, from developers to domain experts.<br /> <br />
So it happened that the project were I am it&#8217;s a financial one: FiX messages routing&#8230;<br /> <br />
There&#8217;s always an on boarding time, a learning curve with a new domain&#8230;<br />
But here things are slightly more complicated than usual&#8230;<br /> <br />
The most important object of the system is a Fix Message.<br /> <br />
It&#8217;s an interesting plain object with around a thousand of fields&#8230;<br /> <br />
There are nice implementation like the <a href="http://www.quickfixengine.org/"><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://www.videnov.com/">mebeli</a></font>QuickFix</a> one where there&#8217;s some object oriented design&#8230; (not a surprise, ThoughtWorks was a big contributor of that project) but since we&#8217;re working with legacy code the choice in the current system it&#8217;s the <a href="http://www.orcsoftware.com/Solutions/Orc-Connect/CameronFIX-Universal-Server/">Cameron</a> implementation, where the APIs are something like message.setField(109, toSomething) or message.getField(115)!<br />
But that&#8217;s not the point of the post.<br />
The first days we built up to improve the current code coverage a nice FixMessageBuilder, to build up for us Cameron Fix messages with speaking names and fluent interfaces, just to understand what we are doing. As you know and as it&#8217;s valid for the internet protocol remembering letters and names it&#8217;s easier than numbers, right?<br />
So another important thing that Domain Driven Design promotes is talk as much as possible with the client, with the Analysts, and that&#8217;s what we did.<br />
And we were talking about OnBehalfOfCompID, ClientID and so on&#8230; With the result of being almost misunderstood or having always a reply back like ah, OnBehalfOfCompID, right, you mean 115!<br />
We then moved (<a href="http://www.linkedin.com/in/shentham">Shen</a><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://www.videnov.com/">mebeli</a></font> first to be honest) speaking like them, there was no choice, I&#8217;m still struggling talking like a calculator. A typical (simplified!)  conversation will now look like:<br />
A message with 35=D and 15=AUD or 100=AX should not go to Fidessa.<br />
Is there anything more agile than changing our language to better fit into the customer needs?<br />
It&#8217;s all your fault <a href="http://www.domainlanguage.com/about/ericevans.html">Eric Evans</a>! <img src='http://www.the-arm.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p>More on financial fun soon, since the next step is a Domain Specific Language for playing with these things <img src='http://www.the-arm.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/04/domain-driven-in-the-financial-world/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Java Essentials</title>
		<link>http://www.the-arm.com/2008/03/java-essentials/</link>
		<comments>http://www.the-arm.com/2008/03/java-essentials/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 09:32:35 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[DDD]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OOD]]></category>
		<category><![CDATA[That's Cool!]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/03/16/java-essentials/</guid>
		<description><![CDATA[My friend Bruno kicked off, silently few weeks ago the Java Essential project. 
What is Java Essential? 
It&#8217;s an open, collaborative book, written in Italian about Java and not only.
It will cover topics like TDD, Object Oriented Design and Domain Driven Design, and all the most current/good/trendy frameworks.
It will be written in Italian, for the [...]]]></description>
			<content:encoded><![CDATA[<p>My friend <a href="http://bbossola.wordpress.com/">Bruno</a> kicked off, silently few weeks ago the Java Essential project.<br /> <br />
What is Java Essential?<br /> <br />
It&#8217;s an open, collaborative book, written in Italian about Java and not only.<br />
It will cover topics like TDD, Object Oriented Design and Domain Driven Design, and all the most current/good/trendy frameworks.<br />
It will be written in Italian, for the Italian Java (not only Java really&#8230;) community, written by the communities, in fact various good guys from various different Java User Groups and Organizations will write the content.<br /> <br />
I&#8217;ve been asked to write the chapter about Domain Driven and since I&#8217;m not a good writer I&#8217;ve asked to <a href="http://www.floydmarinescu.com/">Floyd Marinescu</a> if I can translate his nice Domain Driven Design Quickly, and he agreed.<br /> <br />
Depending on how much it will take and on how much time I&#8217;ll be able to allocate on this project I&#8217;ll translate partially the book for Java Essential or the full book, linking it then on <a href="http://www.infoq.com/">InfoQ</a>.<br />
If there&#8217;s one thing that I care about is to spread around the world what we do and how we do it, last year I had in total four speeches in Rome, Turin, Varese and Bologna, since I&#8217;m a bit far from Europe now, that&#8217;s the best way to continue in that direction <img src='http://www.the-arm.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/03/java-essentials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the anti-if campaign, the double dispatch service locator example</title>
		<link>http://www.the-arm.com/2008/02/on-the-anti-if-campaign-the-double-dispatch-service-locator-example/</link>
		<comments>http://www.the-arm.com/2008/02/on-the-anti-if-campaign-the-double-dispatch-service-locator-example/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 15:46:39 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[anti-if]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/02/04/on-the-anti-if-campaign-the-double-dispatch-service-locator-example/</guid>
		<description><![CDATA[I had a good number of jokes and questions since the announcement of the anti-if campaign.
Do you want to remove all these if? What&#8217;s wrong with the ifs?
So, it&#8217;s better to clarify something.
First of all it&#8217;s not about removing every single if, it&#8217;s about having a more flexible, maintainable and readable code.
A long case (or [...]]]></description>
			<content:encoded><![CDATA[<p>I had a good number of jokes and questions since the announcement of the <a href="http://brainscrum.wordpress.com/2007/11/26/the-anti-if-campaign/">anti-if campaign</a>.</p>
<p>Do you want to remove all these if? What&#8217;s wrong with the ifs?</p>
<p>So, it&#8217;s better to clarify something.</p>
<p>First of all it&#8217;s not about removing every single if, it&#8217;s about having a more flexible, maintainable and readable code.</p>
<p>A long case (or if then else) statement can be difficult to read and follow, maintenance can be painful.</p>
<p>The first category of if to get of rid of, the most immediate it&#8217;s the type based if.</p>
<p>There is clear: something is wrong, the responsibility is not where the if is but in the class itself.</p>
<p>So, an example.</p>
<p>On a project (in a Domain Driven Architecture) we had a fairly long &#8220;if type then, else if type then, etc&#8230;&#8221;</p>
<p>The if chain was on different Tasks Types in a workflow engine.</p>
<p>Let&#8217;s imagine that the workflow is an engine for a touch-less car wash system.</p>
<p>So you have, for example:</p>
<p>InsertCoinTask<br />
2-StepHeatedPreSoakTask<br />
HighPressureTouchFreeWashTask<br />
Tire&amp;WheelCleanerTask<br />
HighPressureRinseTask and so on.</p>
<p>Every task depends on the completion of a previous one and might need a run time configuration.</p>
<p>So, the code was something like this:</p>
<p><code>if (task is InsertCoinTask) </code></p>
<p><code>{ Configure(task as InsertCoinTask) } </code></p>
<p><code>else if (task is StepHeatedPreSoakTask) { </code></p>
<p><code>Configure(task as StepHeatedPreSoakTask) }</code><br />
<code>...</code><br />
Inside of a class called TaskServiceConfigurator, were for example a Configure method was implemented like:</p>
<p><code>private Configure(Tire&amp;WheelCleanerTask task)</code><br />
<code>{</code><br />
<code>task.TirePosition = touchFreeWashTask.LastCarPosition;</code><br />
<code>}</code><br />
The different configure methods inside that class (then private!) were setting previous tasks settings, values and so on.</p>
<p>So, pain points:</p>
<p>- The long if: you can easily forget to configure when adding your task to the workflow to add it there</p>
<p>- Private configuration methods: difficult to test, not only the configuration but also when testing the task itself</p>
<p>- Public setters on the tasks: since each task is configured inside the TaskServiceConfigurator all the setting came from there</p>
<p>Solution to this has been a double dispatch.</p>
<p>We added on the Task Interface a method Configure with the ITaskServiceConfigurator as a parameter, like this:</p>
<p><code>ITask </code><br />
<code>{</code><br />
<code>Configure(ITaskServiceConfigurator configurator)</code><br />
<code>}</code></p>
<p>Tire&amp;WheelCleanerTask is an ITask and the Configure implementation might look like:</p>
<p><code>Configure(ITaskServiceConfigurator configurator)</code><br />
<code>{</code><br />
<code>tirePosition = configurator.LastCarPosition;</code><br />
<code>...</code><br />
<code>}</code></p>
<p>The above example probably is too stupid, but the key point is that the LastCarPosition depends on other task (performed or not) it&#8217;s really a run-time configuration, a real time dependency between tasks.</p>
<p>I found easier to test the tasks, passing a stubbed configuration and the configuration itself had a definitely better code coverage.</p>
<p>Any better solution to this code redesign is more than welcome.</p>
<p>(Task names are taken from this page: http://www.autec-carwash.com/ <img src='http://www.the-arm.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/02/on-the-anti-if-campaign-the-double-dispatch-service-locator-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
