Lecture 16 - MVC Flashcards
Design Patterns
Standard Solutions which are “good” in many situations but we will need to tailor them to specific situations.
MVC
Typically used to construct GUI. Allows us to decouple Model and View. Model is data and operations on data. View is what we see in the User Interface. A controller is used to change the model.
Observer and Observable
Observer - Object that wants to updated when the state of an object changes.
Observable - An object of which the state can be interesting to another object.
Methods in Observable
setChanged - Indicates that this object has changed.
hasChanged - Tests if this object has changed.
clearChanged - Indicates that the object has no longer changed or that it has notified all its observers. Automatically called by notifyObservers.
notifyObservers - Notifies all its observers that the object has changed.