The MVC Architecture


Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts −
  • Model − The lowest level of the pattern which is responsible for maintaining data.
  • View − This is responsible for displaying all or a portion of the data to the user.
  • Controller − Software Code that controls the interactions between the Model and View.
MVC is popular as it isolates the application logic from the user interface layer and supports separation of concerns. Here the Controller receives all requests for the application and then works with the Model to prepare any data needed by the View. The View then uses the data prepared by the Controller to generate a final presentable response.

The Model

The model is responsible for managing the data of the application. It responds to the request from the view and it also responds to instructions from the controller to update itself.

The View

It means presentation of data in a particular format, triggered by a controller's decision to present the data. They are script-based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.

The Controller

The controller is responsible for responding to the user input and perform interactions on the data model objects. The controller receives the input, it validates the input and then performs the business operation that modifies the state of the data model.

Where is MVC Architecture Used?
The MVC model or "pattern" is commonly used for developing modern user interfaces. It is provides the fundamental pieces for designing a programs for desktop or mobile, as well as web applications.
Advantages
  • A main advantage of MVC is separation of concern. Separation of concern means we divide the application Model, Control   and View.
  • We can easily maintain our application because of separation of concern.
  • In the same time we can split many developers work at a time. It  will not affects  one developer work to another developer work. 
  • It supports TTD (test-driven development). We can create an application with unit test. We can write won test case.
  • Latest version of MVC Support default responsive web site and mobile templates.
  • We can create own view engine. It is syntax is very easy compare to traditional view engine. 
Disadvantages
  • Cannot see design page preview like .aspx page. Every time want to run then see the design.
  • Understanding flow of application is very hard one. It is little bit of complex to implement and not suitable for small level applications.
  • It's deployment is little bit hard one. 

Image Courtesy:-www.hackernoon.com
Note:- This blog is for education purpose only.

Comments