Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have asked a similar question before and got an convincing answer as well?

What is difference of developing a website in MVC and 3-Tier or N-tier architecture?

Due to the conclusion of this question I started developing projects in N-tier Architecture.

Just about an hour ago, I asked another question, about what is the best design pattern to create interface? There the most voted answer is suggesting me to use MVC architecture.

What is the best design pattern to design the interface of an WebPage?

Now I am confused, First post suggested me that both are similar, just a difference that in N-tier, the tier are physically and logically separated and one layer has access to the one above and below it but not all the layers.

I think ASP.net used 3 Tier architecture while developing applications or Web applications. Where as frameworks like Zend, Symphony they use MVC.

I just want to stick to a pattern that is best suitable for WebProject Development? May be this is a very silly confusion? But if someone could clear this confusion, that would be very greatful?

like image 390
Starx Avatar asked May 28 '10 17:05

Starx


2 Answers

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.

like image 178
Jeff Sternal Avatar answered Nov 06 '22 15:11

Jeff Sternal


I just want to stick to a pattern that is best suitable for WebProject Development? May be this is a very silly confusion? But if someone could clear this confusion, that would be very greatful?

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.

like image 25
webbiedave Avatar answered Nov 06 '22 17:11

webbiedave