Context
Interactive application with a flexible human-computer interface
Intent
The pattern isolates (business or domain) logic from input and presentation, permitting independent development, testing and maintenance of each.
Participants
Model
It is the domain-specific representation of data, on which the application operates.
View
Renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes.
Views don’t need to be graphical, but can also be plain textual. The common denominator of the views is that they expose certain model information to some outside world.
Controller
Receives input and initiates a response by making calls on model objects.
MVC triads
An MVC application may be a collection of model/view/controller triplets, each responsible for a different UI element.
Advantages
- clear and clean separation of concerns.
- is easy to test code that implements this pattern.
- promotes better code organization and extensibility.
- facilitates de-coupling of the application’s components.
Liabilities
- Potential of excessive number of updates
- Intimate connection between view and controller
MVC isolates the application’s presentation that displays (or otherwise exposes) (model) data in the user interface, from the way the data is actually processed.
In other words, it isolates the application’s data from how the data is actually processed by the application’s business logic.
The main advantage of the MVC design pattern is the isolation of these components: Developers might change any one of them without the rest being affected.