<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results for 'app:weblogs' matching tags 'DDD', 'Software Development', and 'Patterns'</title><link>http://msmvps.com/search/SearchResults.aspx?q=app:weblogs&amp;tag=DDD,Software+Development,Patterns&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags 'DDD', 'Software Development', and 'Patterns'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>A Upcoming Pandemic of Domain Anaemia</title><link>http://msmvps.com/blogs/peterritchie/archive/2009/01/29/a-upcoming-pandemic-of-domain-anaemia.aspx</link><pubDate>Thu, 29 Jan 2009 06:00:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666992</guid><dc:creator>PeterRitchie</dc:creator><description>&lt;p&gt;There&amp;#39;s a well-known anti-pattern called the anaemic domain model[1][2].&amp;nbsp; This anti-pattern basically says domain entities, chronically, have little or no behaviour (remember, object-oriented design is about attributes &lt;strong&gt;and&lt;/strong&gt; behaviour).&lt;/p&gt;
&lt;p&gt;It should be obvious that a domain model that isn&amp;#39;t truly object oriented is a domain model with a problem.&amp;nbsp; But, let&amp;#39;s look at other reasons why the Anaemic Domain Model is an anti-pattern.&amp;nbsp; Your Domain is the nexus, the essence, of your system.&lt;/p&gt;
&lt;p&gt;An anaemic domain model is basically a reporting system.&amp;nbsp; Each &amp;quot;Entity&amp;quot; becomes, essentially, a query.&amp;nbsp; This is fine, reporting systems are necessary and prevalent.&amp;nbsp; But, to shoe-horn a domain model on top of this leads away from good reporting patterns that could add value and increases complexity, needlessly.&amp;nbsp; The designers spend most of their time trying to force entities on the system, without recognizing the basic reporting nature of the system.&amp;nbsp; This usually leads to &amp;quot;reports&amp;quot; that have to pull in multiple domain &amp;quot;entities&amp;quot; to generate the report--rehydringing data into an entity (usually through some sort of ORM) with no value added.&amp;nbsp; i.e. an ORM that will manage the child-parent relationship (and either pre-load or lazy-load aggregates) doesn&amp;#39;t provide much value here.&lt;/p&gt;
&lt;p&gt;The worst case scenario with an anaemic domain model is that there really is behaviour there; but it&amp;#39;s not handled in the domain entities; it&amp;#39;s handled in a different layer.&amp;nbsp; This is a problem because this circumvents the whole point of a domain model and layering.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;One indication of anaemia is that most of the domain classes&amp;nbsp; simply contain attributes.&amp;nbsp; Anyone familiar with patterns should recognize this as a Data Transfer Object, not a Domain Entity.&amp;nbsp; There&amp;#39;s nothing wrong with DTOs, they&amp;#39;re very important in almost all systems with any sort of complexity; but they&amp;#39;re not Domain Entities.&amp;nbsp; Let&amp;#39;s be truthful, there are systems with little or no behaviour in the domain; and that&amp;#39;s not a bad thing.&amp;nbsp; Systems like this likely don&amp;#39;t need a Domain Model and may not need techniques like Domain Driven Design.&amp;nbsp; The quicker people recognize that, the quicker they can be using a more appropriate architecture and design.&amp;nbsp; In some extreme cases the anaemic-domain-entity-DTOs service other DTOs&lt;/p&gt;
&lt;p&gt;Now, where am I going with this?&amp;nbsp; Well, there&amp;#39;s been a series of guidance out of Microsoft Patterns and Practice about some application &amp;quot;patterns&amp;quot;.&lt;/p&gt;
&lt;p&gt;First, let me describe what a pattern is.&amp;nbsp; A pattern is a way of &amp;quot;documenting a solution to a design problem&amp;quot; [3].&amp;nbsp; First, for it to be a pattern, it needs to detail the problem and it&amp;#39;s context, then provide a solution.&amp;nbsp; The latest &amp;quot;patterns&amp;quot; from P&amp;amp;P do not detail the problem or a context.&amp;nbsp; They&amp;#39;re simply architectural descriptions.&lt;/p&gt;
&lt;p&gt;Now the association between the Anaemic Domain Model and the latest P&amp;amp;P guidance.&amp;nbsp; In 3 of the 5 recently publish &amp;quot;patterns&amp;quot; the following is detail is included: &amp;quot;A Domain Entity pattern is used to define business entities that contain data only.&amp;quot;&amp;nbsp; This is the very definition of an Anaemic Domain Model.&amp;nbsp; Plus, in the RIA pattern the following, contradictory, detail is included: &amp;quot;Domain entities are responsible for implementing business rules.&amp;nbsp; Entities from the domain model represent business objects that contain data and implement behavior [sic]. In other words, the business objects are responsible for implementing business operations and interacting with other business objects.&amp;quot;&lt;/p&gt;
&lt;p&gt;This is disconcerting because historically sample code and guidance from Microsoft is simply reused without thought.&amp;nbsp; This leads to poorly designed and architected applications, and the .NET community as a whole is seen as one that produces poor-quality code and design.&amp;nbsp; Without context about the problems these patterns try to solve, they will be misused&amp;mdash;likely forced upon contexts and situations where they don&amp;rsquo;t fit, simply because &amp;ldquo;they&amp;rsquo;re from Microsoft&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;[1] &lt;a href="http://www.martinfowler.com/bliki/AnemicDomainModel.html" title="MF Bliki- AnemicDomainModel"&gt;MF Bliki- AnemicDomainModel&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[2] &lt;a href="http://en.wikipedia.org/wiki/Anemic_Domain_Model" title="Anemic Domain Model - Wikipedia, the free encyclopedia"&gt;Anemic Domain Model - Wikipedia, the free encyclopedia&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[3] &lt;a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)" title="Design pattern (computer science) - Wikipedia, the free encyclopedia"&gt;Design pattern (computer science) - Wikipedia, the free encyclopedia&lt;/a&gt;&lt;/p&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:18e4120a-82b3-45b3-8d5c-9449fa380fad" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Microsoft+Patterns+and+Practicies"&gt;Microsoft Patterns and Practicies&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Anti-patterns"&gt;Anti-patterns&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Anaemic"&gt;Anaemic&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Anemic"&gt;Anemic&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Domain+Model"&gt;Domain Model&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Microsoft"&gt;Microsoft&lt;/a&gt;&lt;/div&gt;
&lt;div style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bf1c39d4-6db7-4130-b9ff-995a8a4cb99f" class="wlWriterSmartContent"&gt;del.icio.us Tags: &lt;a rel="tag" href="http://del.icio.us/popular/Microsoft+Patterns+and+Practicies"&gt;Microsoft Patterns and Practicies&lt;/a&gt;,&lt;a rel="tag" href="http://del.icio.us/popular/Anti-patterns"&gt;Anti-patterns&lt;/a&gt;,&lt;a rel="tag" href="http://del.icio.us/popular/Anaemic"&gt;Anaemic&lt;/a&gt;,&lt;a rel="tag" href="http://del.icio.us/popular/Anemic"&gt;Anemic&lt;/a&gt;,&lt;a rel="tag" href="http://del.icio.us/popular/Domain+Model"&gt;Domain Model&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align:right;margin:0px;padding:4px 0px 4px 0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fmsmvps.com%2fblogs%2fpeterritchie%2farchive%2f2009%2f01%2f29%2fa-upcoming-pandemic-of-domain-anaemia.aspx&amp;amp;title=A+Upcoming+Pandemic+of+Domain+Anaemia"&gt;&lt;img border="0" width="100" src="http://digg.com/img/badges/100x20-digg-button.png" alt="Digg This" height="20" style="border:0;" title="Digg This" /&gt;&lt;/a&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://msmvps.com/blogs/peterritchie/archive/2009/01/29/a-upcoming-pandemic-of-domain-anaemia.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://msmvps.com/blogs/peterritchie/archive/2009/01/29/a-upcoming-pandemic-of-domain-anaemia.aspx&amp;amp;bgcolor=0080C0&amp;amp;fgcolor=FFFFFF&amp;amp;border=000000&amp;amp;cbgcolor=D4E1ED&amp;amp;cfgcolor=000000" alt="DotNetKick This" /&gt;&lt;/a&gt;&lt;/div&gt;</description></item></channel></rss>