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.
Model
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.
View
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.
Controller
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
Basic Structure
- Assets
- CSS
- Images
- JS
- Config
- Database Config File
- Controllers
- Model
- Views
- Remove Duplicate Records from MySQL Server - October 12, 2021
- How to Secure Your Apache Server - September 10, 2021
- Linux security - September 9, 2021