Model-View-Controller • Model: • The model is the programmatic representation of the application's data. • While the model does not typically know how to display itself, it often contains functionality for persisting (and loading) itself from permanent storage.
Model-View-Controller • View: • The View is primarily responsible for rendering the Model for presentation to the user. • Users interact with and manipulate the view in order to change the model. • The view does not itself store data or maintain state and is often updated independently from the Controller or the Model. • Views often declare an interface allowing different Views to work for the same task (e.g., a DesktopView and a MobileView).
Model-View-Controller • Controller: • The Controller contains the main application logic for the system and binds the View to the Model. • The Controller mediates how the Model is updated when the user performs actions in the View. • Controllers are typically tightly bound to the View interface.
References • The material in slides 2 to 7 is retrieved from a software engineering course offering by Dr. Reid Holmes https://github.com/ubccpsc/310/blob/main/ resources/readings/MVStar.md • The material in slides 8 to 11 is retrieved from Head First Design Patterns, Chapter 12.