- Instance of
- Subclass of
Overview
All data
9 statements · 22% with external sources · numbers in brackets are citations
On other databases
5 identifiers linking decorator pattern across the web's reference databases
9 statements · 22% with external sources · numbers in brackets are citations
5 identifiers linking decorator pattern across the web's reference databases
From Wikipedia, the free encyclopedia · Read full article · Text CC BY-SA 4.0
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 instances of the same class. The decorator pattern is often useful for adhering to the Single Responsibility Principle, as it enables functionality to be distributed across classes with distinct concerns. It also supports the Open–Closed Principle, since a class's functionality can be extended without modifying its source code. Using decorators can be more flexible and efficient than subclassing, as an object's behavior can be augmented or combined at runtime without creating an entirely new class hierarchy.