What is better: Developing a Web project in MVC or N -Tier Architecture?

They aren't mutually exclusive. The Model-View-Controller pattern is really a user interface design pattern, and it concerns logical rather than physical tiers I most often hear "n-tier architecture" used to describe the actual physical separation of an application's layers. For example, a system in which the user interface runs in one process, exchanges data with an application layer (perhaps via messaging or web services) that executes in another process (perhaps on another server), which in turn accesses a data layer that runs in yet another process (typically a database server) This description can be particularly confusing because 'application logic' can mean multiple things: in an n-tier system it usually means business logic as opposed to user interface logic (like which widgets are enabled when the user selects a particular checkbox) For example, in an n-tier system, your presentation layer might call a web service method that accepts an item ID.

The web service runs on a different server, where it performs complicated calculations and returns a price In a simpler architecture, your application might calculate the item's price in the same process as the user interface - though the pricing logic may be separated into its own logical layer (perhaps within library or executable) I can't think of any current MVC frameworks that care whether their layers run in separate physical processes or not.

They aren't mutually exclusive. The Model-View-Controller pattern is really a user interface design pattern, and it concerns logical rather than physical tiers. I most often hear "n-tier architecture" used to describe the actual physical separation of an application's layers.

For example, a system in which the user interface runs in one process, exchanges data with an application layer (perhaps via messaging or web services) that executes in another process (perhaps on another server), which in turn accesses a data layer that runs in yet another process (typically a database server). This description can be particularly confusing because 'application logic' can mean multiple things: in an n-tier system it usually means business logic - as opposed to user interface logic (like which widgets are enabled when the user selects a particular checkbox). For example, in an n-tier system, your presentation layer might call a web service method that accepts an item ID.

The web service runs on a different server, where it performs complicated calculations and returns a price. In a simpler architecture, your application might calculate the item's price in the same process as the user interface - though the pricing logic may be separated into its own logical layer (perhaps within library or executable). I can't think of any current MVC frameworks that care whether their layers run in separate physical processes or not.

I think your confusion lies in two areas: 1) The assumption that there's one solution for every problem. The requirement of your project will dictate which solution is best. 2) The definition of MVC when applied to the web is different than when it originally applied to desktop applications.

Some folks say that if the view doesn't talk to the model, then it can't be MVC. Well, most of the web MVC implementations don't have the view talk to the model, yet it's still called MVC. Since you are a self-described amateur, you should embrace this one axiom early on: the programming world is confusing to everyone all the time.

You may want to review the Microsoft Application Architecture Guide. It has a good overview of the available Microsoft technologies from an Architecture standpoint. Chapters that might be of interest to you: Chp 21 Designing Web Applications Appendix B: Presentation Technology Matrix Appendix C: Data Access Technology Matrix As for what is best?

You have to answer that yourself. Make some sample projects using MVC, WebForms, etc.

Web-based MVC is much different than the traditional desktop MVC. The Model simply has no way to update the View, because the web is (for the most part) stateless. Even if you used AJAX to poll the server every couple seconds to check for Model updates, that still wouldn't be "true" MVC because it's not the Model notifying the View, it's the controller constantly "querying" the Models.

The lesson learned is that it really doesn't matter what you label your architecture. There are just so many variants of MVC/3 tier that usually people just lump them under the "MVC" blanket. And all of these are suitable for web development.

I just can't think of any practical way to have the Model actually notify the View through server-side programming (at least not in PHP). If you need this kind of behavior, you should be writing a desktop application. Just write what is natural for you and don't get caught up in terminology debates.

Look at what some of the well known frameworks like CodeIgniter, Kohana, Symfony, CakePHP, and Zend do and pick and choose which features or design patterns you like.

At the moment I'm busy developing a project using the MVP pattern and in an N-tier architecture. I'm using the MVP pattern in the user interface project, ie. The website.

All the data which needs to be shown and used in the website is passed from a webservice. This webservice is connected to a business layer (BLL), which is connected to the data access layer (DAL). The DAL is connected to the database using the Entity Framework.

So in this project I'm using them both. Using MVP instead of MVC though. This way the interface project (website) doesn't has to do hard stuff, only pass through some data which is received from the webservice.

Took me a while to set up, but it works quite wonderfull. Also, there is no real answer to which pattern or architecture is the best.It all depends on what you want and need. If you want to be scalable, an n-tier architecture is a good solution.

If you want to be able to test your UI quite easily, an MVC pattern is good also. There's a ton of other patterns and architectures which would suffice as well, as long as you know how to use them.

There is no which is better. MVC and n-tier are not either or things. One is object/API design, one is system architecture.

The question to distinguish between the two has been asked and answered here: stackoverflow.com/questions/698220/mvc-v....

1 to your original answer. – Jeff Sternal May 28 '10 at 19:19.

They aren't mutually exclusive. The Model-View-Controller pattern is really a user interface design pattern, and it concerns logical rather than physical tiers.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions