DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Building a Tic-Tac-Toe Game Using React
  • Creating MVPs on a Budget: A Guide for Tech Startups
  • Product Vision vs Technical Strategy: Bridging the Product-Engineering Gap
  • Intricacies of Zero-to-One Software Projects

Trending

  • DevOps Consultant vs. DevOps Employee
  • A Step-by-Step Guide to Implementing Columnar Tables in SQL Server
  • The Role of Multi-Agent AI in Optimizing Warehouse Logistics
  • Building a Simple Todo App With Model Context Protocol (MCP)

What is the difference between MVC and MVP?

By 
Aliaksei Papou user avatar
Aliaksei Papou
·
Mar. 07, 13 · Interview
Likes (1)
Comment
Save
Tweet
Share
19.9K Views

Join the DZone community and get the full member experience.

Join For Free

Attracting your attention with the article ‘Is MVC Pattern a Dead End for Application Development? ’ I think I have not explained in enough detail what the mechanism of MVC itself that’s why I should shed light on the MVP as well. I believe it is quite important to understand the difference between MVC and MVP and the common elements of both paradigms.


To figure out the difference let’s have a look at the conditions why MVC has been widely spread out and what benefits it’s provided for application development.

Let’s come back to the past. At the times when AJAX statement still had been unknown. At the times when programmers were afraid of using JavaScript in browser and that’s why had to reload the whole page.

Let’s take a simple example. A user fills out the registration form and sends it to the server. Server validates entered data, determines the errors and sends the form with the filled data back to the user.

Sending data to the server, in fact, we send the event with the data to the particular controller.  It performs some actions with the data and transfers the control to the View. View generates the result with the HTML and sends it back to the user.

What happens? Apparently the whole browser page and its server representation are the one big and distributed visual component. It has events as well as interface and implementation.  


Controller receives events in particular format and that’s why it is possible to send events to it from different views supporting that format. As an example it can be a login form with login and password.  It can be placed for instance in the corner of each page or to be displayed on a separate page as well.

MVC is advantageous to use when components are redrawn on every event received from the user.

MVP was invented on a bit different conditions - when you build the application based on component framework and there is no need to constantly recreate the View.

 

The goal of MVP is to make Views reusable. For that every View implements particular interface and events mechanism to communicate with Presenter. If to take another look at the example with the same form of entrance to the system - now it is possible to create two views – one in the corner of the application and another one within the main window and to subscribe the Presenter to both.  From received event Presenter can get a sender and all data sent by the user via View interface.

As a conclusion it is possible to say that MVC and MVP paradigms are quite similar to each other but their usage depends on the number of conditions. For MVC when View is refreshed every time on a particular event and for MVP when it is not required to recreate View every time.

Having said this I would like to say that to use MVP as well as MVC is not enough to build up agile and scalable applications since they lead to the same problem of tight coupling between modules and require completely new approach that was described in previous article .

Minimum viable product

Opinions expressed by DZone contributors are their own.

Related

  • Building a Tic-Tac-Toe Game Using React
  • Creating MVPs on a Budget: A Guide for Tech Startups
  • Product Vision vs Technical Strategy: Bridging the Product-Engineering Gap
  • Intricacies of Zero-to-One Software Projects

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook