上QQ阅读APP看书,第一时间看更新
Interactions – the behavior between the components
All these three mentioned components act in different ways when talking to each other. A model stores data it is being given from the controller based on commands. A view changes its appearance based on changes happening in the model. A controller can send a command to the model based on a user interaction. One such example is a user deciding to browse between page-based records. A new set of data will need to be retrieved based on the new visual position.
These two basic flows are what mostly happens in an application-based on MVC:
- User interaction: Controller sends command to Model => Model changes => View is updated
- View asks for data: Controller sends command to Model => Model is created/changed => View is updated