Model View Controller (MVC)
The MVC is an architecture pattern that separates an application into three main logical components Model, View, and Controller. Each of these components has its 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.
Now let’s describe below in brief.
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. Users can read or write the data from view. Basically it is responsible for showing end-user content, we can say it is the user interface. It may consist of HTML, CSS, JS.
The user can send a request by interacting with the view, the controller handles these request and send to Model then get appropriate response from the Model, sends the 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
- Multiple developers can work simultaneously on the model, controller, and views.
- MVC enables logical grouping of related actions on a controller together. The views for a specific model are also grouped together.
- Models can have multiple views.
- The framework navigation can be complex because it introduces new layers of abstraction and requires users to adapt to the decomposition criteria of MVC.
- Knowledge of multiple technologies becomes the norm. Developers using MVC need to be skilled in multiple technologies.
Popular MVC web frameworks
- Ruby on Rails
- Zend Framework
- How to convert Text to image using PHP - August 8, 2020
- Multiple Image Upload with Edit Delete using PHP Mysql - August 7, 2020
- How to Upload and Compress an Image using PHP - August 1, 2020