Decorator: Same Phone, More Features
SkyCast is slow and counts every call, so the hub needs today's weather remembered and every ask logged; subclasses for each combination (cached, logged, cached and logged) multiply with every feature, while decorators wrap the weather source in small layers that keep its interface, so features stack in any order without changing SkyCast.
Updated

- Category
- Data Structures
- Level
- Journeyman
- Tags
- Cache, Composition, Decorator Pattern, OOP, Open/Closed Principle