- 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.
推薦閱讀
- 微服務設計(第2版)
- 自己動手寫搜索引擎
- Java應用開發與實踐
- 看透JavaScript:原理、方法與實踐
- C語言程序設計實踐教程
- Mastering Elasticsearch(Second Edition)
- PHP 7從零基礎到項目實戰
- Building Slack Bots
- UX Design for Mobile
- Puppet:Mastering Infrastructure Automation
- Cloud Development andDeployment with CloudBees
- Python深度學習:基于PyTorch
- Java Web開發任務教程
- SQL Server 2012數據庫管理與開發(慕課版)
- Spark Cookbook