Model View Controller (MVC)
The MVC is an architectural pattern that separates an application into three main logical components Model, View, and Controller.
Each of these component has their own role in a Project.
MVC model was first introduced in 1987 in the Smalltalk programming language.
More than 80% of all web app frameworks rely on the Model View Controller architecture.
The model is responsible for getting data from a database, packaging it in data objects that can be understood by other components, and delivering those objects, most of which will happen in response to input from the controller.
It represents how data should be presented to the application user. User can read or write the data from view.
Basically it is responsible for showing end user content, we can say it is user interface.
It may consists of HTML, CSS, JS.
The user can send request by interacting with view, the controller handles these requests and sends to Model then get appropriate response from the Model, sends response to View.
It may also have required logics.
It works as a mediator between View and Model.
Why use MVC?
- Organized Code
- Independent Block
- Reduces the complexity of web applications
- Easy to Maintain
- Easy to modify
- Database Config File