<?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: Coding: An abstract class/ASP.NET MVC dilemma</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22655</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Wed, 16 Sep 2009 22:45:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22655</guid>
		<description>&lt;strong&gt;Coding: An abstract class/ASP.NET MVC dilemma - Mark Needham...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>Coding: An abstract class/ASP.NET MVC dilemma &#8211; Mark Needham&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASP.NET MVC Archived Blog Posts, Page 1</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22619</link>
		<dc:creator>ASP.NET MVC Archived Blog Posts, Page 1</dc:creator>
		<pubDate>Wed, 16 Sep 2009 05:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22619</guid>
		<description>[...] to VoteCoding: An abstract class/ASP.NET MVC dilemma (9/12/2009)Saturday, September 12, 2009 from www.markhneedham.comI previously described a refactoring that we [...]</description>
		<content:encoded><![CDATA[<p>[...] to VoteCoding: An abstract class/ASP.NET MVC dilemma (9/12/2009)Saturday, September 12, 2009 from <a href="http://www.markhneedham.comI" rel="nofollow">http://www.markhneedham.comI</a> previously described a refactoring that we [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetBurner - ASP.net MVC</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22575</link>
		<dc:creator>DotNetBurner - ASP.net MVC</dc:creator>
		<pubDate>Tue, 15 Sep 2009 02:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22575</guid>
		<description>&lt;strong&gt;Coding: An abstract class/ASP.NET MVC dilemma...&lt;/strong&gt;

DotNetBurner - burning hot .net content...</description>
		<content:encoded><![CDATA[<p><strong>Coding: An abstract class/ASP.NET MVC dilemma&#8230;</strong></p>
<p>DotNetBurner &#8211; burning hot .net content&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daily tech links for .net and related technologies - September 13-15, 2009 - Sanjeev Agarwal</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22523</link>
		<dc:creator>Daily tech links for .net and related technologies - September 13-15, 2009 - Sanjeev Agarwal</dc:creator>
		<pubDate>Mon, 14 Sep 2009 06:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22523</guid>
		<description>[...] Development Exploring ASP.NET 4.0—Web Forms and Beyond Coding: An abstract class/ASP.NET MVC dilemma Functional Construction for ASP.NET Web Forms Inheriting Themes for SharePoint publishing sites [...]</description>
		<content:encoded><![CDATA[<p>[...] Development Exploring ASP.NET 4.0—Web Forms and Beyond Coding: An abstract class/ASP.NET MVC dilemma Functional Construction for ASP.NET Web Forms Inheriting Themes for SharePoint publishing sites [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Coding: An abstract class/ASP.NET MVC dilemma at Mark Needham -- Topsy.com</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22509</link>
		<dc:creator>Tweets that mention Coding: An abstract class/ASP.NET MVC dilemma at Mark Needham -- Topsy.com</dc:creator>
		<pubDate>Sun, 13 Sep 2009 21:21:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22509</guid>
		<description>[...] This post was mentioned on Twitter by planettw. planettw said: Mark Needham: Coding: An abstract class/ASP.NET MVC dilemma: I previously described a refactoring that we have b.. http://bit.ly/9mJKi [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by planettw. planettw said: Mark Needham: Coding: An abstract class/ASP.NET MVC dilemma: I previously described a refactoring that we have b.. <a href="http://bit.ly/9mJKi" rel="nofollow">http://bit.ly/9mJKi</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Gray</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22497</link>
		<dc:creator>Jeremy Gray</dc:creator>
		<pubDate>Sun, 13 Sep 2009 15:36:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22497</guid>
		<description>If you introduce NewParentModel as the new base class there is an extra step that has to be taken, that being to update ParentPage to reference NewParentModel instead of ParentModel.

If you instead take the other approach I mentioned and add a new derivation from ParentModel, change BusinessProcessModel1 and 2 to refine it, and then add the new property to the new class, ParentPage (and other references to ParentModel) wouldn&#039;t have to change.

Both approaches work but have their pros and cons. For your scenario, the latter approach may be a better fit.

So, just to be clear on how the latter approach would look:

ParentModel
Property2

SubParentModel : ParentModel
Property1

BP1Model : SubParentModel

BP2Model : SubParentModel

BP3Model : ParentModel</description>
		<content:encoded><![CDATA[<p>If you introduce NewParentModel as the new base class there is an extra step that has to be taken, that being to update ParentPage to reference NewParentModel instead of ParentModel.</p>
<p>If you instead take the other approach I mentioned and add a new derivation from ParentModel, change BusinessProcessModel1 and 2 to refine it, and then add the new property to the new class, ParentPage (and other references to ParentModel) wouldn&#8217;t have to change.</p>
<p>Both approaches work but have their pros and cons. For your scenario, the latter approach may be a better fit.</p>
<p>So, just to be clear on how the latter approach would look:</p>
<p>ParentModel<br />
Property2</p>
<p>SubParentModel : ParentModel<br />
Property1</p>
<p>BP1Model : SubParentModel</p>
<p>BP2Model : SubParentModel</p>
<p>BP3Model : ParentModel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TDD: Testing sub classes at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22493</link>
		<dc:creator>TDD: Testing sub classes at Mark Needham</dc:creator>
		<pubDate>Sun, 13 Sep 2009 12:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22493</guid>
		<description>[...] ran into another interesting testing dilemma while refactoring the view model code which I described in an earlier post to the point where we have an a... which means that we now have 3 classes which did the same thing 80% of the [...]</description>
		<content:encoded><![CDATA[<p>[...] ran into another interesting testing dilemma while refactoring the view model code which I described in an earlier post to the point where we have an a&#8230; which means that we now have 3 classes which did the same thing 80% of the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22477</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Sat, 12 Sep 2009 22:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22477</guid>
		<description>I&#039;m probably not quite understanding something but how would that approach work for BusinessProcessModel3 on the ParentPage?

On the ParentPage say we make use of Property1 and Property2 and Property2 is the one which only exists for BusinessProcessModel1 and BusinessProcessModel2.

So we&#039;d have something like this:

NewParentModel
  Property1

ParentModel : NewParentModel
  Property2

BP1Model : ParentModel

BP2Model : ParentModel

BP3Model : NewParentModel

I guess we would need to change the type for the ParentPage to be &#039;NewParentModel&#039; so that we have a common class for ParentPage. If we have the type for ParentPage as &#039;ParentModel&#039; then I think we&#039;d get a class cast exception when we&#039;re in BP3 since you can&#039;t downcast BP3Model to &#039;ParentModel&#039;?

Maybe there&#039;s a simpler way and I&#039;ve misunderstood...</description>
		<content:encoded><![CDATA[<p>I&#8217;m probably not quite understanding something but how would that approach work for BusinessProcessModel3 on the ParentPage?</p>
<p>On the ParentPage say we make use of Property1 and Property2 and Property2 is the one which only exists for BusinessProcessModel1 and BusinessProcessModel2.</p>
<p>So we&#8217;d have something like this:</p>
<p>NewParentModel<br />
  Property1</p>
<p>ParentModel : NewParentModel<br />
  Property2</p>
<p>BP1Model : ParentModel</p>
<p>BP2Model : ParentModel</p>
<p>BP3Model : NewParentModel</p>
<p>I guess we would need to change the type for the ParentPage to be &#8216;NewParentModel&#8217; so that we have a common class for ParentPage. If we have the type for ParentPage as &#8216;ParentModel&#8217; then I think we&#8217;d get a class cast exception when we&#8217;re in BP3 since you can&#8217;t downcast BP3Model to &#8216;ParentModel&#8217;?</p>
<p>Maybe there&#8217;s a simpler way and I&#8217;ve misunderstood&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Gray</title>
		<link>http://www.markhneedham.com/blog/2009/09/13/coding-an-abstract-classasp-net-mvc-dilemma/comment-page-1/#comment-22473</link>
		<dc:creator>Jeremy Gray</dc:creator>
		<pubDate>Sat, 12 Sep 2009 17:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1631#comment-22473</guid>
		<description>I could be missing something in relation to your requirements but it looks like you just discovered that ParentModel itself needs a base class from which BusinessProcessModel3 will need to derive, leaving BusinessProcessModel1 and BusinessProcessModel2 deriving from what is currently called ParentModel. Alternatively, you could mentally visualize this as adding a new class between ParentModel and BusinessProcessModel1 and 2, with the new property added to the newly-created class.

All in all, this is pretty standard object model evolution, right up until you encounter the diamond problem, at which point you can either do what you&#039;ve done so far (put the property on a base class even though not all derived classes need it) or go for something a bit more esoteric.</description>
		<content:encoded><![CDATA[<p>I could be missing something in relation to your requirements but it looks like you just discovered that ParentModel itself needs a base class from which BusinessProcessModel3 will need to derive, leaving BusinessProcessModel1 and BusinessProcessModel2 deriving from what is currently called ParentModel. Alternatively, you could mentally visualize this as adding a new class between ParentModel and BusinessProcessModel1 and 2, with the new property added to the newly-created class.</p>
<p>All in all, this is pretty standard object model evolution, right up until you encounter the diamond problem, at which point you can either do what you&#8217;ve done so far (put the property on a base class even though not all derived classes need it) or go for something a bit more esoteric.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

