- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 126字
- 2021-06-25 20:52:38
Implementation
The class diagram of the observer pattern is as follows:

The observer pattern relies on the following classes:
- Subject: This is usually an interface that must be implemented by the classes and should be observable. The observers that should be notified are registered using the attach method. When they no longer have to be informed about the changes, they are deregistered using the detach method.
- ConcreteSubject: This is a class that implements the subject interface. It handles the list of observers and it updates them about the changes.
- Observer: This is an interface that is implemented by the objects that should be updated by the changes in the subject. Each observer should implement the update method, which informs them about the new state changes.
推薦閱讀
- 數據科學實戰手冊(R+Python)
- Advanced Machine Learning with Python
- Reactive Programming with Swift
- Python深度學習
- Python Network Programming Cookbook(Second Edition)
- 劍指Java:核心原理與應用實踐
- Visual FoxPro 6.0程序設計
- 跟戴銘學iOS編程:理順核心知識點
- Functional Python Programming
- Instant GLEW
- 數據結構:Python語言描述
- 自己動手構建編程語言:如何設計編譯器、解釋器和DSL
- Apache Solr for Indexing Data
- Zend Framework 2 Cookbook
- Mastering Unity 2017 Game Development with C#(Second Edition)