<?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: Domain Models in presentation frameworks</title>
	<atom:link href="http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Sat, 25 May 2013 16:53:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1106</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Sun, 18 Jan 2009 02:59:35 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1106</guid>
		<description>@Claudio

Right now, working on getting it into a codeplex project, hopefully soon.</description>
		<content:encoded><![CDATA[<p>@Claudio</p>
<p>Right now, working on getting it into a codeplex project, hopefully soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claudio Lassala</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1105</link>
		<dc:creator>Claudio Lassala</dc:creator>
		<pubDate>Sun, 18 Jan 2009 01:23:41 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1105</guid>
		<description>Great post. Have you ever posted more details on your auto-mapping thing for the domain model to ViewModel transport?</description>
		<content:encoded><![CDATA[<p>Great post. Have you ever posted more details on your auto-mapping thing for the domain model to ViewModel transport?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1104</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 18 Dec 2008 13:01:51 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1104</guid>
		<description>@Tore

Short answer: yes we have a strategy for bringing multiple entities together.

Honestly, 95% of the time, if the models are shown on one screen, they likely have a relationship built in already.  If not, we take a hard look at putting it in.

If there are multiple disparate entities in one screen, we look at several things:

- Is each entity related to one section, a widget, that should be made into a partial/subcontroller/partial request/RenderAction call?  If so, we break it out that way
- If not, create a component that combines all the models.  This component likely has some concept in the ubiquitous language, so we often put that component type in our domain.</description>
		<content:encoded><![CDATA[<p>@Tore</p>
<p>Short answer: yes we have a strategy for bringing multiple entities together.</p>
<p>Honestly, 95% of the time, if the models are shown on one screen, they likely have a relationship built in already.  If not, we take a hard look at putting it in.</p>
<p>If there are multiple disparate entities in one screen, we look at several things:</p>
<p>- Is each entity related to one section, a widget, that should be made into a partial/subcontroller/partial request/RenderAction call?  If so, we break it out that way<br />
- If not, create a component that combines all the models.  This component likely has some concept in the ubiquitous language, so we often put that component type in our domain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1103</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 18 Dec 2008 12:34:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1103</guid>
		<description>@Dimitris

Before we had a good mapping strategy, I would have agreed.  Testing manual mapping code is tedious to the point of hair-pulling.  Definitely not every model needs this strategy.  But when we put it in, we were quite surprised how much the presentation technology influenced our designs.  For the projects where domain model is not 1:1 with screens, this strategy definitely helps.</description>
		<content:encoded><![CDATA[<p>@Dimitris</p>
<p>Before we had a good mapping strategy, I would have agreed.  Testing manual mapping code is tedious to the point of hair-pulling.  Definitely not every model needs this strategy.  But when we put it in, we were quite surprised how much the presentation technology influenced our designs.  For the projects where domain model is not 1:1 with screens, this strategy definitely helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tore Vestues</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1102</link>
		<dc:creator>Tore Vestues</dc:creator>
		<pubDate>Thu, 18 Dec 2008 09:25:45 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1102</guid>
		<description>Great post! It gives a very concrete and detailed perspective on these problems.

Two things strike me:

In my experience, a View model that completely hides the Domain model will cause a lot of duplicate code. To me this means you have to have a good strategy for &quot;auto mapping&quot;. Without it there is just way too much overhead. This is a topic you mention but do not go into details with. Some details here would be highly appreciated.

Is your approach (including your &quot;auto mapping&quot; strategy) based on a 1:1 mapping between domain model and presentation model? My experience with this is that the presentation model will sometimes contain information from several domain models. What is your take on this problem?

- Tore Vestues</description>
		<content:encoded><![CDATA[<p>Great post! It gives a very concrete and detailed perspective on these problems.</p>
<p>Two things strike me:</p>
<p>In my experience, a View model that completely hides the Domain model will cause a lot of duplicate code. To me this means you have to have a good strategy for &#8220;auto mapping&#8221;. Without it there is just way too much overhead. This is a topic you mention but do not go into details with. Some details here would be highly appreciated.</p>
<p>Is your approach (including your &#8220;auto mapping&#8221; strategy) based on a 1:1 mapping between domain model and presentation model? My experience with this is that the presentation model will sometimes contain information from several domain models. What is your take on this problem?</p>
<p>- Tore Vestues</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimitris Menounos</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1101</link>
		<dc:creator>Dimitris Menounos</dc:creator>
		<pubDate>Thu, 18 Dec 2008 07:55:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1101</guid>
		<description>I have to dissagree. From my experience, in a project with a couple of hundrend model classes where we use DTOs for the view, I think that they are 90+% pure code duplication and a *terrible mess* to maintain. 

In my personal projects I use the model directly up to the view and grass is alot greener!

</description>
		<content:encoded><![CDATA[<p>I have to dissagree. From my experience, in a project with a couple of hundrend model classes where we use DTOs for the view, I think that they are 90+% pure code duplication and a *terrible mess* to maintain. </p>
<p>In my personal projects I use the model directly up to the view and grass is alot greener!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rasmus Kromann-Larsen</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1100</link>
		<dc:creator>Rasmus Kromann-Larsen</dc:creator>
		<pubDate>Wed, 17 Dec 2008 22:08:16 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1100</guid>
		<description>Jimmy,

great post :-) Really insightful.

Would be really nice to get some pointers on your &quot;automapping&quot; stuff, do you use code-gen or some expression tree thing? Would love a blog post on the general concept. Been thinking about that lately.

- Rasmus.</description>
		<content:encoded><![CDATA[<p>Jimmy,</p>
<p>great post <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Really insightful.</p>
<p>Would be really nice to get some pointers on your &#8220;automapping&#8221; stuff, do you use code-gen or some expression tree thing? Would love a blog post on the general concept. Been thinking about that lately.</p>
<p>- Rasmus.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Harman</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1099</link>
		<dc:creator>Steven Harman</dc:creator>
		<pubDate>Wed, 17 Dec 2008 21:58:37 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1099</guid>
		<description>@jimmy, @Steve (the other one... not myself),
re: the two different &quot;view models&quot; used for a) going to the view, b) coming back from the thew to the controller. I think Chad Myers, Jeremy Miller, &amp; Co. call them a) ViewModel and b) EditModel.

I&#039;m not sure thats any clearer, but I think the important thing is to use two separate models, name them as you see fit, and then use those names consistently.</description>
		<content:encoded><![CDATA[<p>@jimmy, @Steve (the other one&#8230; not myself),<br />
re: the two different &#8220;view models&#8221; used for a) going to the view, b) coming back from the thew to the controller. I think Chad Myers, Jeremy Miller, &#038; Co. call them a) ViewModel and b) EditModel.</p>
<p>I&#8217;m not sure thats any clearer, but I think the important thing is to use two separate models, name them as you see fit, and then use those names consistently.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1098</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Wed, 17 Dec 2008 01:22:47 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1098</guid>
		<description>@Steve

Nope, that&#039;s _exactly_ what we&#039;re doing.  Except we call them &quot;DTO&quot; and &quot;...&quot; ... FormModel?  One is optimized for displaying, and one is optimized for capturing.  Because we&#039;re using auto-mapping from our Domain Model to both of these guys (for edit scenarios, for example), we don&#039;t have to do that boring mapping code.

And exactly how you have your scenario, each xTO carries _exactly_ what is needed, and no more.</description>
		<content:encoded><![CDATA[<p>@Steve</p>
<p>Nope, that&#8217;s _exactly_ what we&#8217;re doing.  Except we call them &#8220;DTO&#8221; and &#8220;&#8230;&#8221; &#8230; FormModel?  One is optimized for displaying, and one is optimized for capturing.  Because we&#8217;re using auto-mapping from our Domain Model to both of these guys (for edit scenarios, for example), we don&#8217;t have to do that boring mapping code.</p>
<p>And exactly how you have your scenario, each xTO carries _exactly_ what is needed, and no more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Burman</title>
		<link>http://lostechies.com/jimmybogard/2008/12/16/domain-models-in-presentation-frameworks/#comment-1097</link>
		<dc:creator>Steve Burman</dc:creator>
		<pubDate>Wed, 17 Dec 2008 00:38:45 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/15/domain-models-in-presentation-frameworks.aspx#comment-1097</guid>
		<description>I have taken the ViewModel concept even further again by having a DTO for taking the information to the view and another DTO that brings information back to the controller.

It certainly seems like overkill in the first instance but is quite manageable with a robust mapping infrastructure. On the project I was working on our biggest problem was not having clear conversations about what was responsible for what. To fix that I created the language of VTO (view transfer object - takes information to the view) and DTO (domain transfer object - takes information towards the domain).

I know this is &#039;SRP to the max&#039; but it has some definite benefits particularly around testability and also in terms of functionality. In the date time example discussed earlier the VTO would carry information to the screen as a string pre-formatted for display according to any presentation rules you may have for date time values. Then after the post action the controller accepts a DTO as its only parameter (leveraging custom binders)  where the value is parsed and carried as a DateTime value.

I would be interested to hear others thoughts.</description>
		<content:encoded><![CDATA[<p>I have taken the ViewModel concept even further again by having a DTO for taking the information to the view and another DTO that brings information back to the controller.</p>
<p>It certainly seems like overkill in the first instance but is quite manageable with a robust mapping infrastructure. On the project I was working on our biggest problem was not having clear conversations about what was responsible for what. To fix that I created the language of VTO (view transfer object &#8211; takes information to the view) and DTO (domain transfer object &#8211; takes information towards the domain).</p>
<p>I know this is &#8216;SRP to the max&#8217; but it has some definite benefits particularly around testability and also in terms of functionality. In the date time example discussed earlier the VTO would carry information to the screen as a string pre-formatted for display according to any presentation rules you may have for date time values. Then after the post action the controller accepts a DTO as its only parameter (leveraging custom binders)  where the value is parsed and carried as a DateTime value.</p>
<p>I would be interested to hear others thoughts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
