Home / cs-notes / Design / Design Patterns / Summary / Adapter vs Decorator
Intent
- Adapter
- Interface Conversion
- Decorator
- Functional enhancement or weakening
Target
- Adapter
- between irrelevant classes
- Decorator
- between sibling classes
Situation
- Adapter
- Whenever
- Decorator
- Maintain old modules
Extensible
- Adapter
- Easy to add or remove
- Decorator
- Always be careful