<?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>Peter Ritchie's MVP Blog : AntiPattern</title><link>http://msmvps.com/blogs/peterritchie/archive/tags/AntiPattern/default.aspx</link><description>Tags: AntiPattern</description><dc:language>en</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 17:10:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1666992</guid><dc:creator>PeterRitchie</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/peterritchie/rsscomments.aspx?PostID=1666992</wfw:commentRss><comments>http://msmvps.com/blogs/peterritchie/archive/2009/01/29/a-upcoming-pandemic-of-domain-anaemia.aspx#comments</comments><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;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1666992" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/.NET+Development/default.aspx">.NET Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Design_2F00_Coding+Guidance/default.aspx">Design/Coding Guidance</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Patterns/default.aspx">Patterns</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/OOD/default.aspx">OOD</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/AntiPattern/default.aspx">AntiPattern</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/DDD/default.aspx">DDD</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/ALT.NET/default.aspx">ALT.NET</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development+Practices/default.aspx">Software Development Practices</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development+Guidance/default.aspx">Software Development Guidance</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Microsoft+Patterns+and+Practices/default.aspx">Microsoft Patterns and Practices</category></item><item><title>House of Cards Design Anti-pattern</title><link>http://msmvps.com/blogs/peterritchie/archive/2009/01/27/house-of-cards-design-anti-pattern.aspx</link><pubDate>Tue, 27 Jan 2009 16:00:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1640963</guid><dc:creator>PeterRitchie</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/peterritchie/rsscomments.aspx?PostID=1640963</wfw:commentRss><comments>http://msmvps.com/blogs/peterritchie/archive/2009/01/27/house-of-cards-design-anti-pattern.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve had this anti-pattern in my head for years.&amp;#160; It&amp;#39;s an observance of some projects and methodologies that I&amp;#39;ve witnessed over the years.&amp;#160; I believe it&amp;#39;s a form of &lt;a href="http://en.wikipedia.org/wiki/Voodoo_programming"&gt;Voodoo Programming&lt;/a&gt;, &lt;a href="http://www.pragprog.com/the-pragmatic-programmer/extracts/coincidence"&gt;Programming by coincidence&lt;/a&gt;, and is often a side effect of &lt;a href="http://en.wikipedia.org/wiki/Cargo_cult_programming"&gt;Cargo Cult Programming&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:large;"&gt;Anti-Pattern Name      &lt;br /&gt;&lt;/span&gt;House of Cards Anti-pattern&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:large;"&gt;Problem      &lt;br /&gt;&lt;/span&gt;A problem occurs when software is written that works in a specific observed scenario but no one knows why it works in that scenario.&amp;#160; Observation of &amp;quot;working&amp;quot; is taken as enough evidence of completeness.&amp;#160; It is very often not enough to observe something working in one scenario for the software to be considered &amp;quot;correct&amp;quot;.&lt;/p&gt;  &lt;p&gt;This is often a result of continual hacks in sole response to correcting bugs without consequence to design or maintainability.&amp;#160; Repeated hacks (cards) are are placed on top of other hacks until something has the appearance of &amp;quot;working&amp;quot; then all development on it stops and no one wants to go near the code again for fear of breaking it.&lt;/p&gt;  &lt;p&gt;At the very least, House of Cards design is fragile, hard to maintain, un-agile.&amp;#160; Worst case it&amp;#39;s is of low quality and prone to error and data lose.&lt;/p&gt;  &lt;p&gt;This is a general sign of &lt;a title="cowboy coding" href="http://en.wikipedia.org/wiki/Cowboy_coding"&gt;cowboy coding&lt;/a&gt;.&amp;#160; I means there is no acceptable methodology, and no real management.&amp;#160; There&amp;#39;s little development direction, and likely no development leadership (at least none with any meaningful experience).&amp;#160; Features are generally driven solely by an external source that communicates directly with developers.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:large;"&gt;Symptoms&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;When reviewing code or questioned about code, developers respond with comments like &amp;quot;don&amp;#39;t touch it, it works&amp;quot;, or &amp;quot;we don&amp;#39;t want to change it because it works&amp;quot;.&amp;#160; There&amp;#39;s a reluctance to change the code because no one really knows &lt;em&gt;why&lt;/em&gt; it works.&amp;#160; The code stagnates, new features are slow to be implemented, and there&amp;#39;s a general un-assuredness about the code.&lt;/p&gt;  &lt;p&gt;The code is generally procedural, although following object-oriented syntax. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div&gt;&lt;span style="font-size:large;"&gt;     &lt;p&gt;Refactored Solution&lt;/p&gt;   &lt;/span&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt; &lt;span style="font-size:large;"&gt;&lt;/span&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Establish experienced development leadership.&amp;#160; Establish a development methodology that separates the stakeholders from the developers.&lt;/p&gt;  &lt;p&gt;Invoke Agile methodologies to manage the requirements of the project and begin Agile redesign of the code employing unit testing, refactoring, patterns, etc.&amp;#160; Aggressively refactor the code adding unit tests to test for specific problems as they arise, until the code is robust and reliable.&amp;#160; Mandate adherence to SOLID principles: classes adhere to Single Responsibility Principle, Open-Closed Principles, Liskov Substitution Principle, Interface Segregation Principle, and uses the Dependency Inversion Principle&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:918eea6e-c712-4c23-b765-f6903cb80363" style="padding-right:0px;display:inline;padding-left:0px;float:none;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/design" rel="tag"&gt;design&lt;/a&gt;,&lt;a href="http://technorati.com/tags/anti-pattern" rel="tag"&gt;anti-pattern&lt;/a&gt;,&lt;a href="http://technorati.com/tags/software+development" rel="tag"&gt;software development&lt;/a&gt;&lt;/div&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right;margin:0px;padding:4px 0px 4px 0px;"&gt;&lt;a href="http://digg.com/submit?url=http%3a%2f%2fmsmvps.com%2fblogs%2fpeterritchie%2farchive%2f2009%2f01%2f27%2fhouse-of-cards-design-anti-pattern.aspx&amp;amp;title=House+of+Cards+Design+Anti-pattern"&gt;&lt;img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /&gt;&lt;/a&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://msmvps.com/blogs/peterritchie/archive/2009/01/27/house-of-cards-design-anti-pattern.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://msmvps.com/blogs/peterritchie/archive/2009/01/27/house-of-cards-design-anti-pattern.aspx&amp;amp;bgcolor=0080C0&amp;amp;fgcolor=FFFFFF&amp;amp;border=000000&amp;amp;cbgcolor=D4E1ED&amp;amp;cfgcolor=000000" alt="DotNetKick This" border="0/" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1640963" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Design_2F00_Coding+Guidance/default.aspx">Design/Coding Guidance</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/AntiPattern/default.aspx">AntiPattern</category></item><item><title>Pontificating Virtual Parameterized Constructors in C#</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/11/18/pontificating-virtual-parameterized-constructors-in-c.aspx</link><pubDate>Tue, 18 Nov 2008 17:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1654469</guid><dc:creator>PeterRitchie</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/peterritchie/rsscomments.aspx?PostID=1654469</wfw:commentRss><comments>http://msmvps.com/blogs/peterritchie/archive/2008/11/18/pontificating-virtual-parameterized-constructors-in-c.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/tomholl/archive/2008/11/18/constructors-and-inheritance-why-is-this-still-so-painful.aspx"&gt;Tom Hollander recently posted&lt;/a&gt; about a change he required to the Enterprise Library for date/time validation.&amp;nbsp; He had to create a new class (rather than modify the Enterprise Library) that derived from another, defective class.&amp;nbsp; One of his complaints was that in order to effectively implement the base class he had to also write matching constructors that simply called the base class.&amp;nbsp; His suggestion was effectively to add the concept of virtual parameterized constructors to C#.&amp;nbsp; I detail &amp;ldquo;parameterized constructors&amp;rdquo; because C# already effectively has virtual default constructors.&amp;nbsp; In the following example the base constructor (Form()) is automatically called by the derivative:&lt;/p&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;MyForm&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Form&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; MyForm()&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Virtual parameterized constructors are not new, and from a mere language standpoint this seems reasonable.&amp;nbsp; Pragmatically though, I believe, this is another story.&amp;nbsp; It seems logical to be able to simply inherit the parameterized constructors of the base class; but, there are so many times that this isn&amp;#39;t the case or some generally accepted principles that would be contravened by a language addition like this. &lt;/p&gt;
&lt;p&gt;Let&amp;#39;s first look at the &lt;a href="http://en.wikipedia.org/wiki/Open/closed_principle"&gt;open/closed principle&lt;/a&gt; (OCP).&amp;nbsp; The OCP suggests classes should be open for extension but closed for modification.&amp;nbsp; Robert Martin suggests [1] properly designed class hierarchies that obey OCP implement an abstraction; i.e. derive from an abstract class or implement an interface.&amp;nbsp; For example: &lt;/p&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;interface&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IShape&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(&lt;span style="color:#2b91af;"&gt;Graphics&lt;/span&gt; graphics);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Rectangle&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IShape&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#008000;"&gt;//...&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(&lt;span style="color:#2b91af;"&gt;Graphics&lt;/span&gt; graphics)&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Second, let&amp;#39;s look at the &amp;quot;&lt;a href="http://www.ubookcase.com/book/Addison.Wesley/CPP.Coding.Standards.101.Rules.Guidelines.and.Best.Practices/0321113586/ch34lev1sec2.html"&gt;prefer composition over inheritance&lt;/a&gt;&amp;quot; principle.&amp;nbsp; The effect of a language change like this on a design that prefers composition should be fairly obvious.&amp;nbsp; Here&amp;#39;s an example of this principle: &lt;/p&gt;
&lt;div style="font-size:10pt;background:white;color:black;font-family:courier new;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;interface&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IPolygon&lt;/span&gt; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(&lt;span style="color:#2b91af;"&gt;Graphics&lt;/span&gt; graphics);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;sealed&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Polygon&lt;/span&gt; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;[] points;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Polygon(&lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;[] points) {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.points = points;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(&lt;span style="color:#2b91af;"&gt;Graphics&lt;/span&gt; graphics) {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i = 1; i &amp;lt; points.Length; i++) {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphics.DrawLine(&lt;span style="color:#2b91af;"&gt;Pens&lt;/span&gt;.Black, points[i-1], points);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Rectangle&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IPolygon&lt;/span&gt; {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Polygon&lt;/span&gt; polygon;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Rectangle(&lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt; location, &lt;span style="color:#2b91af;"&gt;Size&lt;/span&gt; size) {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;[] points = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;[5];&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; points[4] = points[0] = location;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; points[1] = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(location.X + size.Width, location.Y);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; points[2] = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(location.X + size.Width, location.Y + size.Height);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; points[3] = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(location.X, location.Y + size.Height);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Polygon&lt;/span&gt;(points);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(&lt;span style="color:#2b91af;"&gt;Graphics&lt;/span&gt; graphics) {&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon.Draw(graphics);&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Obviously there is no way to use virtual parameterized constructors here.&lt;/p&gt;
&lt;p&gt;Clearly, designs that take into account OCP and prefer-composition-over-inheritance would not benefit from a &amp;quot;virtual parameterized constructor&amp;quot; language addition. &lt;/p&gt;
&lt;p&gt;Finally, let&amp;#39;s look at why a class might have many constructors causing such friction for derivatives.&amp;nbsp; There&amp;#39;s many reasons why a class might have many constructors.&amp;nbsp; I believe all are indications of a poorly designed class.&amp;nbsp; My first thought would be that many constructors is a result of a large class and that the large-class-code-smell should be an indication for redesign.&amp;nbsp; A large class could be in an indication of a motherclass; but in either case this is likely a single responsibility principle (SRP) violation and the class is doing much more than it should and be redesigned.&amp;nbsp; If the class isn&amp;#39;t large but has many constructors, this was likely done not in response to how the class should/would be used but to cover every possible way of constructing the type.&amp;nbsp; This would then be a &lt;a href="http://en.wikipedia.org/wiki/You_Ain&amp;#39;t_Gonna_Need_It"&gt;YAGNI&lt;/a&gt; violation and the number of constructors should simply be pared down. &lt;/p&gt;
&lt;p&gt;But, what about when you have to deal with poorly design hierarchies and don&amp;#39;t have the ability to modify them?&amp;nbsp; A valid point; but, simply for the lack of friction of writing pass-through constructors I don&amp;#39;t think adding to the language to support poorly designed classes is a good for the language or its developers. &lt;/p&gt;
&lt;p&gt;While an addition like virtual parameterized constructors seems benign, its limited actual usefulness makes the effort not worth the reward.&amp;nbsp; Plus, it introduces greater abilities to create poorly designed types. &lt;/p&gt;
&lt;p&gt;[1] &lt;a href="http://www.objectmentor.com/resources/articles/ocp.pdf"&gt;http://www.objectmentor.com/resources/articles/ocp.pdf&lt;/a&gt; &lt;/p&gt;
&lt;div style="text-align:left;margin:0px;padding:4px 4px 4px 4px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://msmvps.com/blogs/peterritchie/archive/2008/11/18/pontificating-virtual-parameterized-constructors-in-c.aspx&amp;amp;title=Pontificating%20Virtual%20Parameterized%20Constructors%20in%20C"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://msmvps.com/blogs/peterritchie/archive/2008/11/18/pontificating-virtual-parameterized-constructors-in-c.aspx&amp;amp;bgcolor=0080C0&amp;amp;fgcolor=FFFFFF&amp;amp;border=000000&amp;amp;cbgcolor=D4E1ED&amp;amp;cfgcolor=000000" alt="DotNetKicks Image" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1654469" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Pontification/default.aspx">Pontification</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Patterns/default.aspx">Patterns</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/OOD/default.aspx">OOD</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/AntiPattern/default.aspx">AntiPattern</category></item></channel></rss>