Should new web applications follow the MVC or MVP pattern?

Please note that I am not asking to select (MVC or MVP), but if one of the two should be used for a web application.

I understand that it may be too much work to convert an old application from its current project to an MVC or MVP template. However, what about the new application? These appear to be the most popular architecture patterns, so should you choose one? If not, what other patterns exist?

If you are not familiar with MVC and / or MVP, a good question to check is What is MVP and MVC and what is the difference? . It has a lot of good answers, including links to various sites that each break.

+6
design-patterns web-applications architecture model-view-controller mvp
source share
8 answers

MVP / MVC works well in web applications because a combination of HTTP verb + URLs is a very good way to determine what action to take. There are reasons not to use it, for example, if your team has extensive experience working with other frameworks, but I would generally recommend the MVP / MVC structure. Your application will be completed faster with higher quality.

+3
source share

Both options are great options.

I would choose MVC because it has wider adoptions and is easier to understand and use for developers (HTML / CSS).

In addition, given the number of frameworks that use the MVC pattern, chunks talk to your colleagues in MVC, you will speak a familiar language.

+2
source share

I posted the following answer to another question, although it might be more appropriate here .

MVC is good for a simple server-side script. In MVC, developers always try to keep the controller very thin. Basically, the controller is designed to select the appropriate model and reflection in the view. But in today's web applications, part of the View has radically changed and become complex enough to create a large, thick and messy controller. So now we need a new place to put in some complex UI management logic. There is P MVP , which is the lead. Therefore, facilitators are responsible for managing logic for a particular user interface component. Don’t worry, the controller is still here called Application Controller . Which ultimately is responsible for switching between the relatively large components of the application. So MVP can also say MVPC (!!) . By the way, that was my way of understanding MVP and obviously not some basic rule.

So, I'm already inclined towards MVP for complex web applications.

+2
source share

Your question: "Should I use one of these design patterns."

I have to say that it really depends on the size of your project. In a very large project that is interdependent with other systems in a large organization with a large budget, I would say that they definitely deserve attention.

I think these templates are often overused in small projects where they can add unnecessary complexity and cost.

The main point of the decoupling is that you can change your database or user interface later or reuse business logic. Often this never happens. You must understand that any of these patterns will take longer to implement and complicate the code quite a bit. Therefore, I highly recommend thinking about it and weighing your options. You can often complete the best solution faster using a very simple architecture that does its job and reduces complexity!

+1
source share

It depends on the structure used. Just use what it supports. Most of the web frameworks I've seen use the front controller template and call it MVC or MVP.

0
source share

I think you need to. They are more difficult to implement, especially in the MS world, because they did everything to promote Web forms and simplify the creation of web applications.
Using them, you program in a straightforward manner, and you feel that you have done a lot of work. But they are slower and harder to maintain after your site gets bigger.
Using MVC and MVP allows you to separate the model (base classes that represent the domain you are working with), controller, and views. Best of all, you can reuse your model in other applications, such as mobile applications or Windows applications. They then have more in common than just a database, so you need to write less code. You just need to write controllers and views.
I'm new to this, but I see the benefits, because when I had to change something in one place, something else crashed somewhere else (so you also need to debug the connection and analyze unit tests). Written tests are not possible in web forms.

However, if you are creating an application to represent a person or company where there is no business logic on the Internet, and you need to do it quickly, Web Forms are good for this. And also for prototyping, so you can show which application can run when done.

0
source share

I like both patterns. My best practice is to choose a pattern that is always better than the NO pattern.

I have developed many applications on both templates, my personal opinion is that when you are a RAD developer, and you are not very good at CSS and javascript (mostly winforms developers who want to create webapp, no offense ;-)) You must use the MVP pattern because it is very easy to use with web application projects.

But when you know what CSS and javascript are, you should consider the ASP.NET MVC pattern.

-one
source share

I would prefer the MVC pattern, simply because there is a loose connection. There is a clear separation between the model, view, and controller, and due to isolation, it is better suited for test-based development, or just for Unit-Testing.

-2
source share

All Articles