decorator pattern
Sign in to savedesign pattern in object-oriented programming
In the Vinony graph
Within Vinony's link graph, decorator pattern is referenced by 117 other articles, and connects out to adapter pattern, object-oriented programming and class.
It is catalogued under the topic Software design patterns.
Its subject is documented across 26 Wikipedia language editions.
Wikidata facts
- Instance of
- software design pattern
- Subclass of
- structural pattern
Show 1 more fact
- Commons category
- Decorator pattern
Sources (2)
via Wikidata · CC0
~33 min read
Encyclopedic overview
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.
Overview
Excerpted from Wikipedia’s “decorator pattern” article, available under the CC BY-SA 4.0 licence.