The decorator pattern is an incredibly useful tool that helps you enhance existing interfaces with an additional functionality and without changing the original implementation. In addition to that, we can apply this additional functionality to any subclass of the original implementation. As such, the decorator is a useful tool for enhancing existing behavior.
Note
A Christmas tree by itself doesn't do much. It stands in one place and looks nice. We can, however, enhance its value by adding decorations, such as colorful lights. This decoration doesn't change the original interface of the tree—it just improves it. Furthermore, we can apply the same decoration to many different kinds of trees, not just a specific sort.
Every decorator operates on an existing interface, which is used in two different places. As it has to support original functionality, it must somehow wrap the original interface. Typically, we use an injection to pass the original component to the decorator's constructor...