visit
In this article we're talking about MVC also known as Model View Controller. Everywhere in the software engineering taking about MVC. So let's jump on to the content.
Model View Controller is a software development architecture, it is a pattern the goal of this pattern is to split a large application into several parts that have their own purpose to illustrate each section.
Let's look at an example where a user requesting a specific page from server based on what URL is the user requesting the server will take the request and sends to a specific controller. This controller is responsible for handling the entire request from the client and will tell the rest of the server what to do with the request. It stands the middle between the other two sections model and view and should not contain very much code.The first thing that happens when a controller receives a request is asked the model.
For information based on the request. The model is responsible for all the data logic of a request. This means the model interacts with the database and handles all validation saving, updating, deleting etc of the data. The controller should never directly interact with the data logic.
It should only even use the model to perform these interactions this means that the controller never has to worry about how to handle the data that it send and receives instead only needs to tell the model what to do and respond to what's the model returns this also means the model has to never worry about handling user requests and what to do on failure or success all of that is controlled by the controller and the model only cares about interacting with the data after the model sends the response back to the controller then needs to interact with the view part.
View is only concerned with how to present the information the controller sends this means the view will be a template file that dynamically renders HTML based on the data from the controller.
The view doesn't worry about how to handle the data and controlling it but instead only cares about how to present data. The view sends the final presentation back to the controller and the controller will handle the sending that presentation back to the user the important thing to note about this design is to model and view never interact with each other any interactions with model and view are done through the controller. Having a controller between the model and view means that the means that the presentation of the data and the logic of the data are completely separated which makes creating complex applications so much easier.
In this blog we're talked about what MVC is and learned about it. So, want to build an application with MVC ?.
Previously published at