Tip:
Highlight text to annotate it
X
Hello ladies and gentlemen. Today I represent you the MVC.
What is MVC? MVC is an architectural style.
M stands for Model, V for View and C for Controller.
The model handles the data and the application states,
the view displays the state of the model and the controller manages user inputs.
Why do we do that? For separation of concerns.
How does it work? The user uses the view for his inputs.
The controller observes the view with the help of the observer pattern,
so the controller gets a notification about the input.
Now we have to differ between certain kinds of user inputs
the ones that changes the state and the ones that doesn't, like scrolling.
If the user input changes the state, the controller makes the appropriate function
calls on the model.
The view observes the model with the help of the observer pattern,
so the view gets a notification when the state of the model changes.
The view requests updates from the model to get the newest state.
Back to the controller we have the other case that the user input was for example scrolling
which doesn't change the state. In this case the controller makes a selection
on the view.
And the best of the MVC you get it for free.