Model view controller versus viewenter model view

What do you say? Any good or bad experience in your projects?

+4
source share
2 answers

I have some tips for you that come from my experience using each.

MVC - This model / architecture is old, tested and verified. Really great for web projects where views are separate from the server (and models).

However, I think there are better templates when a model is available that can be used instead of MVC.

MVP - use it when you do not have a datacontext that allows you to bind (e.g. WinForms). Also, if you cannot use ASP.NET MVC for some reason, but you can still use ASP, MVP can be a simple migration to help you separate your views from your model.

As a final note, I know they didn't ask this, but MVVM is probably the best of the group. You can use this if you have a datacontext that provides a fully recognized method of binding to the properties and methods of other classes (e.g. WPF). MVVM is superior to MVP in that it reduces the amount of code since you no longer need to support view interfaces.

My post MVVM vs MVP vs MVC: explained differences explains this in more detail.

+2
source

Model-View-Controller (MVC) - this software [1], is currently considered as an architectural model used in software development. the template isolates the “domain logic” (application logic for the user) from input and presentation (GUI), allowing independent development, testing and maintenance of each of them.

http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Model-view-presenter is an image software that is considered to be derived from the model of model-view-controller.

http://en.wikipedia.org/wiki/Model-view-presenter

So,

MVC is a design pattern. A design pattern is a code structure that allows you to quickly replicate common coding structures. You can think of a design pattern in the form of a skeleton or frame on which your application will be created. The most obvious advantage of the MVC framework is that it helps you separate business logic (database) and presentation logic (design).

Basically:

  • Models contain any code related to your database and other data structures. If you have a table called pages, you will have a model for it and will function inside it to select, create, update and delete records from this table, among other things.

  • Views contain all display and user interface elements, JavaScript code, cascading style sheets (CSS), HTML, and even PHP.

  • Controllers hold everything together. Each controller function represents a destination or route. If you have a / about destination, your controller will have a function called about (). Basically, the controller decides which model and which view to run. This is a contract between types and models.

0
source

Source: https://habr.com/ru/post/1308925/


All Articles