2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Model-View-Controller
|
|
|
|
folder: model-view-controller
|
2015-08-15 18:03:05 +02:00
|
|
|
permalink: /patterns/model-view-controller/
|
2015-08-20 21:40:07 +02:00
|
|
|
categories: Presentation Tier
|
2015-12-28 15:52:44 +02:00
|
|
|
tags:
|
|
|
|
- Java
|
|
|
|
- Difficulty-Intermediate
|
2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Intent
|
|
|
|
Separate the user interface into three interconnected components:
|
2015-08-13 23:54:40 +02:00
|
|
|
the model, the view and the controller. Let the model manage the data, the view
|
|
|
|
display the data and the controller mediate updating the data and redrawing the
|
|
|
|
display.
|
|
|
|
|
|
|
|

|
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Applicability
|
|
|
|
Use the Model-View-Controller pattern when
|
2015-08-13 23:54:40 +02:00
|
|
|
|
2015-08-15 18:03:05 +02:00
|
|
|
* you want to clearly separate the domain data from its user interface representation
|
2015-09-03 18:17:07 +05:30
|
|
|
|
2016-01-03 21:14:30 +01:00
|
|
|
## Credits
|
2015-09-03 18:17:07 +05:30
|
|
|
|
|
|
|
* [Trygve Reenskaug - Model-view-controller](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller)
|
2015-09-24 12:23:02 +05:30
|
|
|
* [J2EE Design Patterns](http://www.amazon.com/J2EE-Design-Patterns-William-Crawford/dp/0596004273/ref=sr_1_2)
|
|
|
|
* [Patterns of Enterprise Application Architecture](http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420)
|