<?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: MVC and n-layer architecture</title>
	<atom:link href="http://www.cmjackson.net/2010/01/18/mvc-and-n-layer-architecture/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cmjackson.net/2010/01/18/mvc-and-n-layer-architecture/</link>
	<description>Web Design, Programming, Tutorials</description>
	<lastBuildDate>Tue, 13 Dec 2011 14:46:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Chris Jackson</title>
		<link>http://www.cmjackson.net/2010/01/18/mvc-and-n-layer-architecture/comment-page-1/#comment-2680</link>
		<dc:creator>Chris Jackson</dc:creator>
		<pubDate>Thu, 04 Nov 2010 18:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cmjackson.net/?p=302#comment-2680</guid>
		<description>@Shaun
Thanks for your comments!

I could not get the first link to open. My computer could not find the domain.

I am (constantly) searching for ways to improve my application designs. This post has already fallen out-of-date with my current designs which somewhat follow with what you have suggested.

Currently, I do use a persistence layer which contains my repositories, data connections, other data sources, etc.  This layer also contains my domain model.

I also use a Service layer (model) which contains the service classes.

The user interface items (controllers / views) reside in my main MVC project along with some helper classes that return HTML to the views.

While I like the idea of having a domain model in the service layer and kept hidden from the other layers, I&#039;ve ran into problems that forced me to revert back to my current design just to get the work done.

I really like this design: http://jeffreypalermo.com/blog/the-onion-architecture-part-1/

I think the Onion Architecture keeps your code cleaner and will help limit rewriting and retesting code. You should check it out.  I think this design would go well with your ideas.

So far the problems I&#039;ve seen with Onion Architecture are: 

- The outter-most layer (that starts the application) needs to be a Dependency Injection layer and I have not figured out how to make this work with ASP.NET MVC.

- When data is passed from the repositories (which have their own model) to the service layer (the domain model), mapping must be done to copy the data from how the database is designed into how you want to use it in your model. Changing something in the database becomes a pain because you have to update your database model and the mappings.

- Creating view models began to get too bulky, but this was probably due to me trying to use the same view model for many different views.  It probably would have worked better by creating a separate view model for each view.

I want to migrate into the Onion Architecture design, but I still need to resolve a few more issues.</description>
		<content:encoded><![CDATA[<p>@Shaun<br />
Thanks for your comments!</p>
<p>I could not get the first link to open. My computer could not find the domain.</p>
<p>I am (constantly) searching for ways to improve my application designs. This post has already fallen out-of-date with my current designs which somewhat follow with what you have suggested.</p>
<p>Currently, I do use a persistence layer which contains my repositories, data connections, other data sources, etc.  This layer also contains my domain model.</p>
<p>I also use a Service layer (model) which contains the service classes.</p>
<p>The user interface items (controllers / views) reside in my main MVC project along with some helper classes that return HTML to the views.</p>
<p>While I like the idea of having a domain model in the service layer and kept hidden from the other layers, I&#8217;ve ran into problems that forced me to revert back to my current design just to get the work done.</p>
<p>I really like this design: <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-1/" rel="nofollow">http://jeffreypalermo.com/blog/the-onion-architecture-part-1/</a></p>
<p>I think the Onion Architecture keeps your code cleaner and will help limit rewriting and retesting code. You should check it out.  I think this design would go well with your ideas.</p>
<p>So far the problems I&#8217;ve seen with Onion Architecture are: </p>
<p>- The outter-most layer (that starts the application) needs to be a Dependency Injection layer and I have not figured out how to make this work with ASP.NET MVC.</p>
<p>- When data is passed from the repositories (which have their own model) to the service layer (the domain model), mapping must be done to copy the data from how the database is designed into how you want to use it in your model. Changing something in the database becomes a pain because you have to update your database model and the mappings.</p>
<p>- Creating view models began to get too bulky, but this was probably due to me trying to use the same view model for many different views.  It probably would have worked better by creating a separate view model for each view.</p>
<p>I want to migrate into the Onion Architecture design, but I still need to resolve a few more issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.cmjackson.net/2010/01/18/mvc-and-n-layer-architecture/comment-page-1/#comment-2466</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Mon, 20 Sep 2010 02:50:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.cmjackson.net/?p=302#comment-2466</guid>
		<description>I enjoyed reading this posting.  It is well written.  I have a couple of comments/opinions.

I think your diagram should have three layers in which everything else resides: Persistence, Model, and Presentation...

The three tier architecture was suggested by David Anderson in the following post and I agree with most of his approach: http://www.uidesign.net/Articles/Papers/UsingMVCPatterninWebInter.html

There should be a Persistence layer consisting of the Repositories, (Database Connection and Database), and (Data Connection and Other Data Sources).

The Model layer should be visible in the diagram.  The Model layer should include the Services and the Domain Objects, in addition to the business/problem logic.

The Controller is a logic unit handling input, so it it should not need direct access to the Domain Objects.  Dealing with the Domain Objects should be limited to Model layer entities.

You may also want to give some thought about peeling out the View (output) and Controller (input) into a Presentation layer, as suggested by both David Anderson and Aviad Ezra, although I don&#039;t agree with everything Aviad Ezra says either, as it does not quite fit the next generation web apps, but comes very close IMHO: http://aviadezra.blogspot.com/2007/07/twisting-mvp-triad-say-hello-to-mvpc.html

Merging what you propose in with what is proposed in the other two posts, plus making the browser a client-side Presentation layer, makes for a very workable paradigm for the next generation browser applications (notice I did NOT say &quot;web applications&quot;).  I&#039;d post a diagram, but these comments are text only.  :)

Just my 2 cents.</description>
		<content:encoded><![CDATA[<p>I enjoyed reading this posting.  It is well written.  I have a couple of comments/opinions.</p>
<p>I think your diagram should have three layers in which everything else resides: Persistence, Model, and Presentation&#8230;</p>
<p>The three tier architecture was suggested by David Anderson in the following post and I agree with most of his approach: <a href="http://www.uidesign.net/Articles/Papers/UsingMVCPatterninWebInter.html" rel="nofollow">http://www.uidesign.net/Articles/Papers/UsingMVCPatterninWebInter.html</a></p>
<p>There should be a Persistence layer consisting of the Repositories, (Database Connection and Database), and (Data Connection and Other Data Sources).</p>
<p>The Model layer should be visible in the diagram.  The Model layer should include the Services and the Domain Objects, in addition to the business/problem logic.</p>
<p>The Controller is a logic unit handling input, so it it should not need direct access to the Domain Objects.  Dealing with the Domain Objects should be limited to Model layer entities.</p>
<p>You may also want to give some thought about peeling out the View (output) and Controller (input) into a Presentation layer, as suggested by both David Anderson and Aviad Ezra, although I don&#8217;t agree with everything Aviad Ezra says either, as it does not quite fit the next generation web apps, but comes very close IMHO: <a href="http://aviadezra.blogspot.com/2007/07/twisting-mvp-triad-say-hello-to-mvpc.html" rel="nofollow">http://aviadezra.blogspot.com/2007/07/twisting-mvp-triad-say-hello-to-mvpc.html</a></p>
<p>Merging what you propose in with what is proposed in the other two posts, plus making the browser a client-side Presentation layer, makes for a very workable paradigm for the next generation browser applications (notice I did NOT say &#8220;web applications&#8221;).  I&#8217;d post a diagram, but these comments are text only.  <img src='http://www.cmjackson.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Just my 2 cents.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

