13 / 07 / 2022

50. What is MVC?

MVC stands for Model, View, Controller and is used to define how these three different entities can interact with each other. First, the Controller handles user requests and delegates information between the Model and the View. It only deals with requests, and never handles data or presentation. It will get data from the Model, which handles data validation, logic, and persistence. It interacts directly with the database to handle the data. Finally, the controller will interact with the View which handles presenting the information. It will usually render dynamic HTML pages based on the data the model fetches. The Controller is responsible for passing that data between the Model and View, so that the Model and View never have to interact with each other. Also, it will send the information back to the User.
This is the basic architecture for building web servers.