Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 622 Bytes

File metadata and controls

17 lines (9 loc) · 622 Bytes

Decorator

You want to add behavior or state to individual objects at run-time. Inheritance is not feasible because it is static and applies to an entire class Decorator attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

PlantUML model

plantuml code

Another good example use case of this pattern would be logger, where user might log events in multiple storages:

PlantUML model

plantuml code