Friday, August 25, 2006

Is 3 Layered Architecture = MVC

Very nice discussion is going on this thread.

At first after reading the post, I also got confused by striking similarities between two patterns thought one is design pattern other one is application pattern.
Survic has written a nice post on confusion regarding MVC.

This is one of best articulated posts that I have come across on this topic.

If you don’t understand confusion about MVC then read

First there are two documented versions of MVC

Here is sample of discussion on MVC and ASP.Net in which I took part

If you thought that this is enough then there is a MVP pattern.

Example of

After that Martin Fowler splits MVP into two parts to clear confusion (But now I am more confused)

I always use MVC as GUI or WEB based design pattern.
MVC is a design pattern for Interactive Interfaces.(LudovicoVan corrected me)
MVC in web context is more geared towards streaming HTML to different devices that understand HTML while 3 layer architecture is independent of any technology.

One comment was that we should implement MVC in every layer of application.
I think that I know what the poster is implying.
Generally I believe in understanding the intent of pattern and implementing it my way that suits my project. But at the same time, we have to maintain some essence of design pattern for clear communication. While I understand what the poster is implying, I think that are specific patterns (factory,fascade,process layer,Aggregation etc) to describe the patterns applicable to good enterprise distributed computing needs.

Note: I am going to revisit this post


survic said...

You have a way to find things to discuss!

This MVC thing prompts me to think about why MVC is so confusing, there are 5 elements:

Vikas said...

Hi Survic,
This is one of best articulated posts that I have come across on this topic.
But you can ignore MVC only if you are streaming HTML only to Browser.
if you are streaming HTML to other devices (e.g,. Mobile,Excel,MsWord), you have to use some form of MVC.
As you said code-behind is tied to view, it is not a true controller. So from code-behind, you have to initiate a true controller and keep your code(creating and manipulating Model) there.