<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jak Charlton - Insane World : SOA, DDD</title><link>http://devlicio.us/blogs/casey/archive/tags/SOA/DDD/default.aspx</link><description>Tags: SOA, DDD</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Solving Complexity with Message Based Architectures </title><link>http://devlicio.us/blogs/casey/archive/2010/02/04/solving-complexity-with-message-based-architectures.aspx</link><pubDate>Thu, 04 Feb 2010 07:55:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55264</guid><dc:creator>Jak Charlton</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/casey/rsscomments.aspx?PostID=55264</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/casey/commentapi.aspx?PostID=55264</wfw:comment><comments>http://devlicio.us/blogs/casey/archive/2010/02/04/solving-complexity-with-message-based-architectures.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;Ultimately most complexity in software comes not from the
requirements, the business logic, or even the underlying systems. Most
complexity comes out of a poorly considered and managed architecture, and this
is commonly seen in tightly coupled systems that rapidly degrade into Big Balls
of Mud.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;The key to simplifying architectures is to decouple their
component parts, making each more specialised and less dependent on the
others. This allows every component to focus on a specific task without risk of
those tasks becoming compromised by, or interfering with, others.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;The basic premise of most architectures that succeed in
this way is that they are message based, rather than being glorified CRUD
systems pulling data to and from databases. Operations are central to the
system, data is ultimately just the storage for the results of those
operations.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;This separation of concerns allows development teams to
concentrate on component parts with little impact upon other teams, and no more
reliance upon them than an agreement on the messages they will listen for and
those they will publish. While messages share some characteristics of service
interfaces, they differ mostly in their granularity and lack of dependence upon
one another. Messages allow true decoupling, where traditional service layers
only promise this and usually end up creating even more tightly coupled
systems.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;&amp;quot;Message based&amp;quot; does not inherently mean SOA, and in many
ways differs substantially. Although both can be considered message based, SOA
brings significant overhead and generalisation, along with an organisation wide
remit. Simple message based systems operate on the basis of message within the application
rather than across an enterprise.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;Poor software architecture ends up impacting more than
just the software system under development, and frequently the impact can be
felt across an organisation; in the way development teams approach problems, in
the way they respond to new requirements, and throughout the SDLC.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;More often than not, the SDLC is a reflection of the weaknesses
in software architecture, and is frequently trying to play &amp;#39;catch up&amp;#39; to attempt
to deal with the issues weak architecture brings. These compromises and aspects
of the SDLC then start to propagate and impact other areas of the development and
support process. Often decisions about software architecture become the underlying
drivers for the entire IT department, and the SDLC turns into a point of
conflict as it becomes more about trying to restrain and control a big ball of
mud than it does about providing a framework for providing business value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55264" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/casey/archive/tags/Practices+and+Principles/default.aspx">Practices and Principles</category><category domain="http://devlicio.us/blogs/casey/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://devlicio.us/blogs/casey/archive/tags/DDD/default.aspx">DDD</category><category domain="http://devlicio.us/blogs/casey/archive/tags/SOA/default.aspx">SOA</category></item><item><title>Commercial Suicide - Integration at the Service Level</title><link>http://devlicio.us/blogs/casey/archive/2009/05/19/commercial-suicide-integration-at-the-service-level.aspx</link><pubDate>Tue, 19 May 2009 07:03:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:46913</guid><dc:creator>Jak Charlton</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/casey/rsscomments.aspx?PostID=46913</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/casey/commentapi.aspx?PostID=46913</wfw:comment><comments>http://devlicio.us/blogs/casey/archive/2009/05/19/commercial-suicide-integration-at-the-service-level.aspx#comments</comments><description>&lt;p&gt;In my previous post I described &lt;a href="http://devlicio.us/blogs/casey/archive/2009/05/14/commercial-suicide-integration-at-the-database-level.aspx"&gt;the problems with trying to integrate your organisation at the database level&lt;/a&gt;, and the fallacies surrounding the idea of the One True Authority Database. I also alluded to this being a problem with services too.&lt;/p&gt;
&lt;p&gt;When you try to create a monolithic and authoritarian database that knows all, sees all, and brings everything into a single coherrent whole, you are heading down a slippery slope. Different applications have different requirements, and even within the same job role, the meaning of Customer can have a totally different meaning in two different contexts. I also argued that data has no value without context, and the context is the application that is meeting the business requirements, be these user interaction, system interaction, or reporting.&lt;/p&gt;
&lt;h3&gt;SOA to the Rescue!&lt;/h3&gt;
&lt;p&gt;I&amp;#39;m not arguing without ample evidence behind me here - the idea of integration at a database level was one that was well discredited many years ago. I grant you many organisations haven&amp;#39;t got the message yet, and that many vested interests still keep trying to make the magic solution work, but fundamentally a long time back we in IT recognised that the One True Authority Database (OTADB)&amp;nbsp;was a &amp;quot;bad thing&amp;quot; - and this lead us to the promised land - initially Web Services and then on to Service Oriented Architectures.&lt;/p&gt;
&lt;p&gt;SOA is an attempt to resolve the OTADB issue - take all those database calls, and even calls to different databases, and unify them through a set of coherrent and cohesive services - SOA can provide us with the abstraction over out data stores that is required - and now we can have the One True Authority Service Layer.&lt;/p&gt;
&lt;p&gt;With SOA we can define services to wrap our databases, services to update data, service to read and query data, and even services to unify those &amp;quot;different&amp;quot; Customers into a&amp;nbsp;single coherrent and canonical data model.&lt;/p&gt;
&lt;p&gt;And that&amp;#39;s where it all goes wrong again.&lt;/p&gt;
&lt;h3&gt;Anti-Pattern: The&amp;nbsp;Canonical Data Model&lt;/h3&gt;
&lt;p&gt;Back when our database guys were trying to integrate all this information, what they were trying to achieve, but maybe didn&amp;#39;t realise, was a canonical data model - this is the &amp;quot;holy grail&amp;quot; of SOA. &lt;a href="http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Addison-Wesley/dp/0321200683/"&gt;Martin Fowler describes&lt;/a&gt; it thus:&lt;/p&gt;
&lt;p style="PADDING-LEFT:30px;"&gt;&lt;span class="Apple-style-span" style="TEXT-ALIGN:left;WIDOWS:2;TEXT-TRANSFORM:none;TEXT-INDENT:0px;BORDER-COLLAPSE:separate;WHITE-SPACE:normal;ORPHANS:2;LETTER-SPACING:normal;COLOR:#000000;WORD-SPACING:0px;-webkit-border-horizontal-spacing:0px;-webkit-border-vertical-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0;"&gt;How can you minimize dependencies when integrating applications that use different data formats? &amp;hellip;Design a Canonical Data Model that is independent from any specific application. Require each application to produce and consume messages in this common format&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Sounds perfect! We now have a way of abstracting our systems from each other, and our canonical data model will pull this information all together at the end.&lt;/p&gt;
&lt;p&gt;So, I&amp;#39;m going out on a limb here, disagreeing with Martin Fowler is rarely a smart move.&lt;/p&gt;
&lt;p&gt;Except I&amp;#39;m not disagreeing with Martin Fowler so much as I am disagreeing with those that try to implement his ideas and principles. I don&amp;#39;t recollect anywhere that Martin says that all data can be squeezed into this model, or that this model is the &amp;quot;one true view&amp;quot;. In fact, later evolutions of Martin&amp;#39;s work have included things like Domain Driven Design, which is almost the opposite of a canoncial data model - DDD says that you have a different model for every domain or context, each specifically engineered to solve the problem at hand. Given the choice, I am certainly in the DDD camp here - after all data without context is worthless, and it is the domain (and&amp;nbsp;DDD) that provides the context.&lt;/p&gt;
&lt;p&gt;The key and important part of a canonical data model is it provides a mapping between inconsistent formats and differing views of data.&lt;/p&gt;
&lt;p&gt;So as an ideal, the canonical data model is fine - in practice it is often a major anti-pattern.&lt;/p&gt;
&lt;p&gt;There is still no One True Authority, and SOA really never promised this, nor did the canonical data model - what they promised was enough abstraction to allow applcaitions to work independently, and to fulfill their specific requirements independently. And then to leave it to the service layers to unify this data.&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;So Service Oriented Architectures HAVE Come to the Rescue?&lt;/h3&gt;
&lt;p&gt;Not quite - again my argument here isn&amp;#39;t so much about SOA, or any of the things around it, but more the people who try to implement it, often&amp;nbsp;without understanding what they are trying to achieve, the problems that SOA or a service layer solves,&amp;nbsp; or even the amount of effort that is required to get a canonical data model right.&lt;/p&gt;
&lt;p&gt;The key part here is that a canonical data model is a massive excercise to do right. Essentially it means analysing every applciation, every service and every database within your organisation and extracting their individual requirements and current functionality, and trying to distill that down to a set of common definitions.&lt;/p&gt;
&lt;p&gt;While this may be eventually achievable, in practice it is almost never the case. This &amp;quot;holy grail&amp;quot; of SOA is much like the &amp;quot;holy grail&amp;quot; of integration at the database level, eventually it boils down to &amp;quot;the problem is too complex, too fast moving and too indeterminate to define&amp;quot;. In development we figured out long ago that we needed Agile to help us move quickly as requirements shifted and changed, but the OTADB and the SOA canonical data model do not allow this to happen, they seek to solidify the design early.&lt;/p&gt;
&lt;p&gt;SOA done &amp;quot;right&amp;quot; may well make this problem smaller, but SOA is rarely done right.&lt;/p&gt;
&lt;h3&gt;Can Domain Driven Design Help?&lt;/h3&gt;
&lt;p&gt;DDD was largely an attempt to address these problems - by identifying that individual applications and contexts required different data, DDD allowed us to recognise that square pegs and round holes do not match. Eventually with a big enough hammer you may be able to force it through, but there is going to&amp;nbsp;be a lot of effort and a lot of collaterel damage.&lt;/p&gt;
&lt;p&gt;Domain Driven Design includes terms like &amp;quot;Domain&amp;quot;, &amp;quot;Bounded Context&amp;quot; and&amp;nbsp;&amp;quot;Anti Corruption Layer&amp;quot;&amp;nbsp;specifically to deal with the issues around trying to use a &amp;quot;one solution fits all&amp;quot; hammer to crack what is quite a simple nut. &lt;/p&gt;
&lt;p&gt;DDD is largely unconcerned with what other things Domains talk to, or even how, all that matters is that within a Domain there is one logical view of the world, tailored to the requirements of that specific Domain. Beyond that Domain, there may be a large central database, there may be a perfect canonical data model, but at application level, we have the Domain, Bounded Contexts and Anot Corruption Layers to protect us from all of that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DDD gives us a loosely coupled way of thinking.&lt;/p&gt;
&lt;h3&gt;So SOA is Evil and&amp;nbsp;the One True Authority Database is Evil?&lt;/h3&gt;
&lt;p&gt;Well hardly, but unfortunately we live in an imperfect world, and the people implementing these noble ideas are often far from perfect. They do not have mystical powers of future vision, and they do make mistakes.&lt;/p&gt;
&lt;p&gt;By creating properly decoupled systems, and in this I certainly do not mean &amp;quot;systems that use web services&amp;quot;, we can isolate our applications from external change and influence, and ensure we meet the requirements we have today, and can react quickly to future requirements as they appear.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Big Design Up Front is still BDUF, whether it is done at a database level, a service level, or in a canonical data model.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=46913" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/casey/archive/tags/Practices+and+Principles/default.aspx">Practices and Principles</category><category domain="http://devlicio.us/blogs/casey/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://devlicio.us/blogs/casey/archive/tags/DDD/default.aspx">DDD</category><category domain="http://devlicio.us/blogs/casey/archive/tags/SOA/default.aspx">SOA</category></item></channel></rss>