What is "decorator-pattern"
Decorator or wrapper, is a software design standard that allows you to add behavior to an existing object at runtime, that is, dynamically aggregates additional responsibilities to an object.
Intent
- Add responsibilities to an object dynamically.
- Provide flexible alternative to using subclasses to extend the functionality of a class
Consequences
- More flexibility than inheritance (Adding or removing responsibilities at runtime; Adding the same property more than once).
- Prevents over-functionality in classes.
- Decorator and its component are not identical.
- Results in a design that has several small objects, all similar.
Bibliographic References:
- Using UML and Standards 2nd Edition - Craig Larman.