-
Book Overview & Buying
-
Table Of Contents
Practical Design Patterns for Java Developers
By :
The decorator pattern provides the ability to add new functionality to objects by placing those objects in a decorator, Sothat a decorated instance provides extended functionality. The implementation of the decorator pattern is relatively simple and dynamic in languages such as Python and Kotlin. On the other hand, Java may provide more stability and maintainability of the source code through visibility and new enhancements, which can be very valuable. The decorator pattern was identified and described by the GoF.
With the decorator pattern, you can dynamically attach additional responsibilities to an object. A decorator provides a flexible alternative to subclasses to extend the functionality of a class. The decorator can be added statically or dynamically without altering the current behavior of an object.
Uses of the decorator pattern can be found in the Java collections framework...