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.

By

Updated

Cheat sheet: Decorator: Same Phone, More Features
Category
Data Structures
Level
Journeyman
Tags
Cache, Composition, Decorator Pattern, OOP, Open/Closed Principle