Programming Pattern: MVC vs MVP
Asked Answered
B

1

7

I'm a little bit confused about these two programming patters: MVC and MVP.

Which are the main differences between them?; I have been searching on the net and I made a couple of examples of both of them, but I'm even more confused, because in some sample web pages MVP uses more than 2 interfaces to communicate the presenter with the view layer (some ones even have completely blank interfaces, only declarated), but in other ones it only takes two interfaces to transport data from presenter to view. Which is the correct way of applying that pattern?

On the other hand, I have been working on MVC for a while, but until now, I realize that maybe I had been aplying the pattern in the wrong way. I have had this:

  • Model: C# classes that behaves like the bussiness objects.
  • Controller: C# classes that uses the model objects to fill them or manipulate them.
  • View: C# aspx pages to show the model objects; the controller is the responsible of sending the model objects to this layer after manipulating and/or filling them with data.

I hope you can clear my doubts. Thanks in advance.

Barbarous answered 9/3, 2010 at 18:54 Comment(2)
Try this: #2556Aroid
Possible duplicate of What are MVP and MVC and what is the difference?Lorikeet
H
0

MVC

View is responsible for rendering the UI elements. The controller responds to the UI actions. And the model handles the business behavior. The controller is responsible for which view want to display. The whole business logic layer can be represented by the Model. The view and the model are tightly coupled.

MVP

View is responsible for rendering the UI elements. The role of controller is replaced with a presenter. The presenter mediates the actions between both models and views. There isnt a mechanism for binding views to view models. So we rely on each view implementing an interface with the view

Hadhramaut answered 22/10, 2021 at 13:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.