Design Pattern - 2. Observer

1,013 views
969 views

Published on

Refers:
Head First Design Pattern.

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,013
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Design Pattern - 2. Observer

  1. 1. <ul>Observer Pattern </ul><ul>Company Name </ul>
  2. 2. <ul>Observer </ul><ul><li>Problem : </li><ul><li>We have to change values through methods in a class </li></ul></ul>
  3. 3. <ul>Update observer from Subject Object </ul>
  4. 4. <ul>Observer from Subject Object </ul>
  5. 5. <ul>Class Diagram Observer </ul>
  6. 6. <ul>Final Diagram </ul>
  7. 7. <ul>Interfaces Observer </ul><ul>// interfaccia subject per i metodi di registrazione, cancellazione e notifica di un objserver Public interface Subject { </ul>public void registererObserver(Observer o); public void removeObserver(Observer o); public void notifyObserver(); <ul>} // interfaccia con metodo specifico dell'observer per update degli observer </ul>Public interface Observer { public void update(float temp); } // interfaccia con metodo display per la visualizzazione Public interface DisplayElement{ public void display(); }
  8. 8. <ul>Subject implementation </ul>
  9. 9. <ul>Observer implementation </ul>
  10. 10. <ul>Subject implementation with java built-in </ul>
  11. 11. <ul>Observer implementation with java built-in </ul>

×