Dalton
Dalton

Reputation: 1354

Difference between asp.net MVC and MVP? are they both same?

I wanted to know the difference between asp.NET MVC and MVP, are they both same? below is the architecture diagram I referred.

(Image URL:http://msdn.microsoft.com/en-us/library/ff647859.aspx)

MVC vs MVP

the major difference I got to know between MVC and MVP from the diagram is, in MVC the Model updates the view and in MVP the Presenter updates the view.

But here is my confusion.Below is a asp.net MVC code sample.

public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return View();
        }

    }

here the Controller returns/updates the view so now according to the diagram it is MVP

Is asp.net mvc and MVP similar? if not what is the difference ?Can someone guide me.

Upvotes: 14

Views: 15576

Answers (4)

VahidNaderi
VahidNaderi

Reputation: 2488

Actually MVP is a subset of MVC pattern.

In your example of asp.net mvc the controller does not updates the view rather it just pass the model to the view and the view get updated according to the model.

But in MVP (which is usually used with winforms and webforms in Microsoft stack) the presenter get data from view, updates the model and when the model changed, the presenter will read the model and updates the view.

Upvotes: 9

Liam
Liam

Reputation: 29750

That MVC diagram looks misleading to me. I would regard this as a more actuate architectural diagram:

enter image description here

this is from a PHP site but here you can clearly see the relationship between the view and the controller.

The differences between MVC and MVP are subltle, this question (as mentioned above) clarifies those differences.


That MSDN page also clearly says

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies....

I think this resource pre-dates Asp.Net MVC.

The articles themselves are for something call the Composite UI Application Block and are from 2005. I'd go to http://www.asp.net/mvc/ for some more up to date and acurate information on MVC.

Upvotes: 5

Regfor
Regfor

Reputation: 8101

Try to understand MVC and MVP concept without connection to any technology.

Action method in ASP.NET MVC controller returns ActionResult with View method doesn't break any pattern. It just say that controller functionality is done and let's render the view from markup with Razor/ASP.NET syntaх.

In ASP.NET world - ASP.NET MVC is impelemntation of MVC pattern. Forgotten Web Client Software factory is MVP implementation

Upvotes: 0

Pantelis Natsiavas
Pantelis Natsiavas

Reputation: 5369

No.They are not the same. They are two different paradigms (design patterns) used for user interaction. Based on these paradigms, ASP.NET team developed two different frameworks for writing web applications. The first is ASP.NET Web Forms based on an event based form programming. The second is ASP.NET MVC which is based on using Model Views and Controllers (MVC).

I suppose you could start reading here which is written by one of the ASP.NET development team members.

Regarding the specific question. I think that the Controller updates the View using the Model to do it. Model does not do anything. Or this is the way I understand it, anyway...

Hope I helped!

Upvotes: 0

Related Questions