20 likes | 110 Views
Generic pattern . The subject will send each observer the update() message when the event occurs. The subject may have many observers. Their types are not known. They are only known as objects that implement the observer interface. Subjects and observers are loosely coupled. «interface»
E N D
Generic pattern The subject will send each observer the update() message when the event occurs. The subject may have many observers. Their types are not known. They are only known as objects that implement the observer interface. Subjects and observers are loosely coupled. «interface» Subject «interface» Observer * attach() detach() notify() update() The observer knows the subject and registers with that object using the attach() message. ConcreteObserver ConcreteSubject update() … attach() detach() notify() … ACS-3913 Ron McFadyen
Generic pattern «interface» Subject «interface» Observer * subject attach() detach() notify() update() observer Observer Concrete subject Concrete observer ConcreteObserver ConcreteSubject update() … attach() detach() notify() … ACS-3913 Ron McFadyen