observer pattern aleksandar kartelj. ideja not long ago my clutch gave out, so i had my jeep towed...
DESCRIPTION
Primene u stvarnom životu Newsletter, grupe Pretplata na časopis Obaveštenja javnih službi Sudski pozivi itd...TRANSCRIPT
Observer pattern
Aleksandar Kartelj
Ideja• Not long ago my clutch gave out, so I had my Jeep
towed to a local dealership. I didn't know anybody at the dealership, and none of them knew me, so I gave them my telephone number so they could notify me with an estimate. That arrangement worked so well we did the same thing when the work was finished. Because this all turned out perfectly for me, I suspect the service department at the dealership employs the same pattern with most of its customers.
Primene u stvarnom životu
• Newsletter, grupe• Pretplata na časopis• Obaveštenja javnih službi• Sudski pozivi itd...
UML model Observera
Primene u programiranju
1. MVC je baziran na Observeru – Smalltalk2. Document View Architecture – skoro
ekvivalentno MVC-u (Ažuriranje promena u različitim pogledima istog dokumenta)
Observer u javi
• Observer interfejs– update
• Observable klasa– addObserver– notifyObservers
Jedna promena – više zainteresovanih
• Primer sa bojenjem polja