MVC Intro
MVC Intro
I. DEFINITION
first introduced by Trygve Reenskaug (Smalltalk dev. at Xerox Palo Alto Research Center,
1979)
helps decouple data access and business logic
three elements
1. Model
o represents data and the rules that govern access to and updates of this data
o software approximation of a real-world process
2. View
o renders the contents of the model
o specifies exactly how the model data should be presented
o if model changes => the view must update its presentation as need
- push model: the view registers itself with the model for change
notifications
- pull model: the view is responsible for calling the model when it need to
retrieve the most current data
3. Controller
o translates the user's interactions with the view into actions that the model
performs
o user's interactions being: button clicks, menu selections, …
o may also select a new view – e.g. a web page of results – to present back to
user