- 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.
推薦閱讀
- Learning Java Functional Programming
- Pandas Cookbook
- Python深度學(xué)習(xí)
- Learning ASP.NET Core 2.0
- NumPy Essentials
- Java Web開發(fā)技術(shù)教程
- SAS數(shù)據(jù)統(tǒng)計分析與編程實(shí)踐
- Drupal 8 Configuration Management
- Instant PHP Web Scraping
- Angular Design Patterns
- Unity Android Game Development by Example Beginner's Guide
- Python機(jī)器學(xué)習(xí)與量化投資
- 你真的會寫代碼嗎
- Solr權(quán)威指南(下卷)
- Java程序設(shè)計實(shí)用教程(第2版)