Created Wednesday 26 February 2014
- MVC is just a variation of 3 design patterns: Observer, Strategy, and Composite Patterns. Sometimes MVC also uses Factory and Template patterns
- A Model represented domain-specific data and was ignorant of the user-interface (Views and Controllers). When a model changed, it would inform its observers.
- A View represented the current state of a Model. The Observer pattern was used for letting the View know whenever the Model was updated or modified.
- Presentation was taken care of by the View, but there wasn't just a single View and Controller - a View-Controller pair was required for each section or element being displayed on the screen.
- The Controllers role in this pair was handling user interaction (such as key-presses and actions e.g clicks), making decisions for the View.
Recall:
- Strategy - encapsulates an algorithm inside a class separating the selection from the implementation
- Composite - a structure of simple and composite objects which makes the total more than the sum of its parts
No backlinks to this page. comments powered by Disqus