Model View Controller or MVC is a programming pattern that allows for the separation of data and user interface (presentation) aspects of an application. MVC web application development India helps in the structuring of the code in order to ensure that the changes made in the way the data is handled and organized does not effect the user interface and vice versa.
The architecture is made up of three components. These include the following:
The Model component contains the data and the business logic of the application. In MVC, the Model is independent of the View and Controller. In order to be independent, the Model cannot directly refer to the View and Controller. Models can be of the following types:
- Active: In an Active Model changes made in the model are immediately notified to the Controller and View.
- Passive: In a Passive Model changes are not notified to the Controller or View. In case the Controller processes a request that changes the Model and affects the View, the Controller sends a notification of the same to the View. The View can then obtain the updated data from the Model.
This is user interface of the application. It renders the information obtained from data model. The View can access the Model only to read the data, it cannot make any changes to the Model.
The Controller is the component that receives and processes inputs sent by a user. Based on the type of requests sent, the Controller will send requests to the Model and View. The Controller can change the state of the Model.
Benefits of MVC
The MVC Architecture offers the following benefits:
- The data and presentation are separate
- Program codes can be re-used
- Multiple versions of the User Interface can be created
- Developers can focus on a specific area (i.e. user interface / business logic) without having to worry about the other.