- model:
- stores data (e.g., the time for a clock object)
- provides methods to change data (e.g., setTime())
- provides methods to retrieve data (e.g., getTime())
- may change data itself based on internal logic (e.g., a clock tick() method)
- has no reference to the controller
- has a generic reference to the view, used to notify the view when data changes
- may have multiple view/controller pairs registered (e.g., an analog and a digital clock display)
view:
- renders the model
- adjusts display to reflect changes in model (e.g., positions hands on a clock based on new time)
- has a reference to the model, used to retrieve data
- has a reference to the controller, used to pass on input events
- should always have a controller, or a null controller for non-input based views
controller:
- responds to user input
- has a reference to the model, used to request changes to the model based on user input (e.g., set time of a clock)
- has a reference to the view, used to request display-only changes to the view based on user input (e.g., change clock display from 12-hour to 24-hour)