The Model-View-Controller pattern
The Model-View-Controller (MVC) pattern is a software architecture pattern that is widely used for the UI of an application. It is particularly well suited to web applications, although it can also be used for other types of applications, such as desktop applications.
The pattern provides a structure for building user interfaces and provides a separation of the different responsibilities involved. A number of popular web and application development frameworks make use of this pattern. A few examples include Ruby on Rails, ASP.NET MVC, and Spring MVC.
The MVC pattern consists of the Model, View, and Controller:

The model, view, and controller all have distinct responsibilities for the user interface. Let's take a look at each of them more closely.
Model
The model manages the application data and the state. Among its responsibilities is the processing of data to and from a data store, such as a database. A model is independent of the controllers and the views,...