MVC (Model View Controller) is an architectural pattern for the software dealing with the user interface (web or desktop). The three components of the MVC pattern are:
Also Read: Django Introduction
Model: This is the lowest level of the architecture which is absolutely responsible for the maintenance of the data. It is a representation of the business logic and the structure of the data.
View: The display of the data on the application is decided by the view. The developer can either choose to display all the data to the user or just a portion of it.
Controller: This code of the software deals with the interaction between the model and the view of the software.
The popularity behind the MVC pattern is its isolation of application logic from the UI layer. It promotes addressing of concerns separately. As shown in the given flowchart, whenever an event takes place, the Controller receives the request and then start working with the Model component to prepare the data required by the View to display. The last step includes the working of the View to generate the final response to the request which will then be displayed on the app. Here is the graphical representation of the MVC pattern.
Model: The management and maintenance of the data for the application come under the Model component. It is responsible for responding to the request sent by the View and work accordingly as per the instructions of the Controller.
View: It gets initiated once the Controller calls for the View component. It presents the data on the application in a specified format. A View is a script-based template which makes it possible to integrate with the AJAX technology.
Controller: The responsibility of this component is to respond to the given user inputs and interact with the Model component accordingly. The three major tasks of a Controller are to receive input, validate them and finally proceed for the business operation which will modify the state of the data model.