16 lines
684 B
Markdown
16 lines
684 B
Markdown
|
|
# Observer Pattern
|
||
|
|
|
||
|
|
## Description
|
||
|
|
Define a one-to-many dependency relationship so that when one object's state changes, all dependent objects are notified and automatically updated.
|
||
|
|
|
||
|
|
## Use Cases
|
||
|
|
Load this skill when you need to solve design problems described by this pattern in your code.
|
||
|
|
|
||
|
|
## Guidelines
|
||
|
|
1. Analyze whether current code structure matches the pattern's intent.
|
||
|
|
2. Refactor or implement following the pattern's typical structure.
|
||
|
|
3. Ensure the pattern introduction reduces coupling or improves flexibility.
|
||
|
|
|
||
|
|
## Detailed Reference
|
||
|
|
For more details, diagrams, and code examples: [Observer Pattern - RefactoringGuru](https://refactoringguru.cn/design-patterns/observer)
|