These are my notes about the book Headfirst Design Patterns.
The last chapter, finally!
- Controller: manipulates model; can ask View to change as well (holds reference to both Model and View)
- Model: keep state & data; tell View the state has changed (does not know View or Controller -- they register as observers)
- View: update display; tells Controller of user input; request Model for data (holds reference to both Model and Controller)
Design patterns in MVC
- Model: Observer pattern to keep View and Controller updated; sometimes use Adapter pattern to adapt a model to work with existing views and controllers.
- Controller: Strategy pattern. Controller is the "Strategy" behavior for the View. Swappable.
- View: Composite pattern to manage the windows/display.
- A set of patterns combined to solve a general problem.