-
Overview
From [1], Decorator pattern (or simply called a decorator) is a design pattern.
Decoraters are simply functions, it performs a task, the difference to the common function is that decorators apply logic or change the behavior of other functions.
Its the excellent way to reuse code.
-
Decorator pattern
In Object-Oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, dynamically, without affecting the behavior of other objects from the same class.
The decorator pattern is often useful for adhering to the Single Responsibility Principle, as it allows functionality to be divided between classes with unique areas of concern</