Observer: sync post code blocks to repo exactly, split merged AlertObserver/PortfolioObserver block, Java 25, H6 file labels, fix stale console output, README mapping
This commit is contained in:
18
README.md
18
README.md
@@ -389,6 +389,24 @@ javac 03-behavioral/memento/*.java -d out/memento
|
||||
java -cp out/memento memento.Main
|
||||
```
|
||||
|
||||
### Observer (`03-behavioral/observer/`)
|
||||
|
||||
| Post Section | File(s) |
|
||||
|---|---|
|
||||
| Implementation: Stock Price Monitoring — the Observer interface | `StockObserver.java` |
|
||||
| Implementation: Stock Price Monitoring — the Subject | `StockMarket.java` |
|
||||
| Implementation: Stock Price Monitoring — AlertObserver | `AlertObserver.java` |
|
||||
| Implementation: Stock Price Monitoring — PortfolioObserver | `PortfolioObserver.java` |
|
||||
| Implementation: Stock Price Monitoring — wiring it together | `Main.java` |
|
||||
|
||||
Note: the "Push vs Pull Notification Models" pull-model snippet and the "Thread Safety" `CopyOnWriteArrayList` snippet are illustrative only — they are not part of this repository's runnable example.
|
||||
|
||||
Run it:
|
||||
```bash
|
||||
javac 03-behavioral/observer/*.java -d out/observer
|
||||
java -cp out/observer observer.Main
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
- *Design Patterns: Elements of Reusable Object-Oriented Software* — Gamma, Helm, Johnson, Vlissides
|
||||
|
||||
Reference in New Issue
Block a user