Model View Controller (MVC) Pattern

The model view controller pattern is the most used pattern for today’s world web applications. The MVC pattern separates an application in 3 parts: Model, View and Controller.

images/webmaster/model-view-controller-mvc-pattern.jpg

The model is responsible to manage the data. It stores and retrieves entities used by an application, from a database, and contains the logic implemented by the application.

The view (presentation) is responsible to display the data provided by the model in a specific format.

The controller handles the model and view layers to work together. The controller receives a request from the client, invokes the model to perform the requested operations and sends the data to the View. The view formats the data to be presented to the user, in a web application as an html output.

The controller is the first thing which takes a request, parses it, initializes and invoke the model and takes the model response and sends it to the presentation layer.