Model: The model represents data and where business logic is performed, which may cause changes to data, like retrieving data from database, etc…
View: The view renders the contents of a model. It specifies exactly how the model data should be presented. If the model data changes, the view must update its presentation as needed.
Controller: The controller translates the user’s interactions with the view into actions that the model will perform.
What is View ?
The view is the interface the user sees and interacts with. For Web applications, this has historically been an HTML(with CSS and JavaScript) interface.
Handling all of these interfaces in your application is becoming increasingly challenging.
Advantage of MVC Design Pattern
What is Model?
The next component of MVC, the model, represents enterprise data and business rules. It’s where most of the processing takes place when using MVC. Databases fall under the model.
The data returned by the model is display-neutral, meaning that the model applies no formatting.
This way, a single model can provide data for any number of display interfaces. This reduces code duplication, because model code is only written once and is then reused by all of the views.
What is Controller?
Finally, the controller interprets requests from the user and calls portions of the model and next view as necessary to fulfill the request. So when the user clicks a Web link or submits an HTML form, the controller itself doesn’t output anything or perform any real processing. It takes the request and determines which model components to invoke and which formatting to apply to the resulting data.
To summarize the interaction steps
2. Controller determines what portions of the model and view to call.
3. The model handles interaction with data and applies business rules and then returns data.
4. Finally, the appropriate view is determined(by controller) and formatting is applied to the resulting data for presentation.
5. And then View gets displayed to the end user.