<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Inheritance is Evil: The Epic Fail of the DataAnnotationsModelBinder</title>
	<atom:link href="http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/</link>
	<description>by Michael Valenty</description>
	<lastBuildDate>Thu, 05 Jan 2012 07:24:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Michael Valenty</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-1842</link>
		<dc:creator>Michael Valenty</dc:creator>
		<pubDate>Wed, 20 Apr 2011 23:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-1842</guid>
		<description>The function AddValidationErrorsToModelState could for example, loop over the properties of the model and validate the values against the validation attributes. This class shouldn&#039;t also do the model binding, it should stick to the single responsibility of validation. They are unrelated concerns and there clearly are times when I would like one behavior without the other.

The author went to great lengths to build out an extensible model binder. The problem is that it&#039;s a difficult task to guess all the ways that something might be used. It&#039;s safer to stick to one thing and do it well, that way when new requirements creep up, they can be composed rather than trying to force it into an extensibility model that didn&#039;t consider what you are trying to do.</description>
		<content:encoded><![CDATA[<p>The function AddValidationErrorsToModelState could for example, loop over the properties of the model and validate the values against the validation attributes. This class shouldn&#8217;t also do the model binding, it should stick to the single responsibility of validation. They are unrelated concerns and there clearly are times when I would like one behavior without the other.</p>
<p>The author went to great lengths to build out an extensible model binder. The problem is that it&#8217;s a difficult task to guess all the ways that something might be used. It&#8217;s safer to stick to one thing and do it well, that way when new requirements creep up, they can be composed rather than trying to force it into an extensibility model that didn&#8217;t consider what you are trying to do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cDima</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-1841</link>
		<dc:creator>cDima</dc:creator>
		<pubDate>Wed, 20 Apr 2011 15:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-1841</guid>
		<description>Awesome post. But how would this call tie into the MVC DataAnnotation model?

AddValidationErrorsToModelState(model, controllerContext);</description>
		<content:encoded><![CDATA[<p>Awesome post. But how would this call tie into the MVC DataAnnotation model?</p>
<p>AddValidationErrorsToModelState(model, controllerContext);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Refactoring C# Style &#124; Agile at Work</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-831</link>
		<dc:creator>Refactoring C# Style &#124; Agile at Work</dc:creator>
		<pubDate>Sat, 27 Nov 2010 23:39:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-831</guid>
		<description>[...] convenience methods on the IUnitOfWork interface and implement them in an abstract base class, but inheritance is evil and it’s a tradeoff we don’t have to make in C#.   This entry was posted on Saturday, November [...]</description>
		<content:encoded><![CDATA[<p>[...] convenience methods on the IUnitOfWork interface and implement them in an abstract base class, but inheritance is evil and it’s a tradeoff we don’t have to make in C#.   This entry was posted on Saturday, November [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tmont</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-274</link>
		<dc:creator>tmont</dc:creator>
		<pubDate>Wed, 06 Jan 2010 07:01:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-274</guid>
		<description>I think the point is that mutable members shouldn&#039;t be exposed to derived class. As in, getFoo() should be public/protected and setFoo() should be private (except in certain cases like a DTO or something).

But of course, the whole point of inheritance is to reuse code, so a lot of the time you want encapsulation around the object rather than the class. If that&#039;s not what you&#039;re after, than you&#039;re better off with something like a decorator or a composite.

Inheritance is only evil if used incorrectly, as Mike so eloquently illustrated in the case of the DataAnnotationsModelBinder.</description>
		<content:encoded><![CDATA[<p>I think the point is that mutable members shouldn&#8217;t be exposed to derived class. As in, getFoo() should be public/protected and setFoo() should be private (except in certain cases like a DTO or something).</p>
<p>But of course, the whole point of inheritance is to reuse code, so a lot of the time you want encapsulation around the object rather than the class. If that&#8217;s not what you&#8217;re after, than you&#8217;re better off with something like a decorator or a composite.</p>
<p>Inheritance is only evil if used incorrectly, as Mike so eloquently illustrated in the case of the DataAnnotationsModelBinder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Valenty</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-273</link>
		<dc:creator>Michael Valenty</dc:creator>
		<pubDate>Wed, 06 Jan 2010 01:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-273</guid>
		<description>It would be less bad in that your subclass wouldn&#039;t rely on details of the base class, but the more important issue is that you lose out on composition.</description>
		<content:encoded><![CDATA[<p>It would be less bad in that your subclass wouldn&#8217;t rely on details of the base class, but the more important issue is that you lose out on composition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asaph</title>
		<link>http://www.agileatwork.com/inheritance-is-evil-the-story-of-the-epic-fail-of-dataannotationsmodelbinder/comment-page-1/#comment-272</link>
		<dc:creator>Asaph</dc:creator>
		<pubDate>Wed, 06 Jan 2010 00:43:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.agileatwork.com/?p=312#comment-272</guid>
		<description>You say:

&quot;Your base class breaks encapsulation by exposing implementation details to subclasses in the form of protected members&quot;

Would the situation be any better if we used private members instead of protected?</description>
		<content:encoded><![CDATA[<p>You say:</p>
<p>&#8220;Your base class breaks encapsulation by exposing implementation details to subclasses in the form of protected members&#8221;</p>
<p>Would the situation be any better if we used private members instead of protected?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

