Question:  What is Model-View-Controller (MVC) architecture?

 

Answer:  The MVC paradigm (design pattern) is a way of breaking an application, or even just a piece of an application's interface, into three parts: the model, the view, and the controller.  MVC was originally developed to map the traditional input, processing, output roles into the GUI realm:

 

Input --> Processing --> Output
Controller --> Model --> View

 

The user input, the modeling of the external world, and the visual feedback to the user are separated and handled by model, viewport and controller objects.  The controller interprets mouse and keyboard inputs from the user and maps these user actions into commands that are sent to the model and/or viewport to effect the appropriate change.  The model manages one or more data elements, responds to queries about its state, and responds to instructions to change state.  The viewport manages a rectangular area of the display and is responsible for presenting data to the user through a combination of graphics and text.


Separating responsibilities among model, view, and controller objects reduces code duplication and makes applications easier to maintain.  It also makes handling data easier, whether adding new data sources or changing data presentation, because business logic is kept separate from data.  It is easier to support new client types, because it is not necessary to change the business logic with the addition of each new type of client.