Model View Controller Pattern

Model View Controller is a design pattern used to decouple user interface from business logic. Below are some of the reasons to decouple user interface from business logic

  • In many applications user interface changes are drastic compared to the business logic changes. If they are bound together a small change to user interface requires retesting the business logic.
  • Same data needs to be present to user in different forms/layouts or on different devices.
  • Organization want to abandon existing UI framework and move to a completely different UI framework or want to support multiple devices.
  • To keep the business logic testing independent from user interface testing. Automating UI testing is difficult compared the business logic testing.
  • Two different teams handling user interface and business logic development.

Hence, it is better to design applications in such a way that user interface and business logic evolve independently. Test Driven Development involving user interfaces should follow MVC or a variant of MVC pattern approach.

MVC separates the modeling of the domains, presentation and actions based on the user inputs into separate classes.


Model represents the data and behavior of the domain. Model is the source of data for the view, model responds to the views request for data. Controller is the one who populates and updates the data in the Model, Model provides behavior to update its data which is used by the Controller. Model is independent, it does not depend on either Controller or View.


View manages the display of information to the user, it gets the data to be displayed from the model. Multiple views can be designed for the same Model.


Controller responds to user actions by updating the Model with latest data and notifying the view of changes (or renders a new view). The business logic related decisions are made in the controller and it is also responsible to render appropriate view to a specific user action.