> Design Patterns > Decorator Design Pattern
Decorator design pattern is used to add additional responsibilities to an object dynamically.
The intent of decorator design pattern is to provide flexible alternative to subclassing by adding responsibilities to an object dynamically.
We may require to add some additional functionality to the object. This may be done by using inheritance but that will make it static and inflexible and client will not be able to add functionality as it is required.
So additional functionality request will be forwarded to this object which will be responsible for adding the required functionality.
Here is the decorator factory design pattern example.
There is an IDE (Integrated Development Environment). Provide additional features generating UML diagrams and reading executable dynamically.
C++ | Decorator Pattern in C++ | Decorator Pattern C++ Example |
C# | Decorator Pattern in C# | Decorator Pattern C# Example |
Java | Decorator Pattern in Java | Decorator Pattern Java Example |
Python | Decorator Pattern in Python | Decorator Pattern Python Example |
JavaScript | Decorator Pattern in JavaScript | Decorator Pattern JavaScript Example |
PHP | Decorator Pattern in PHP | Decorator Pattern PHP Example |
Ruby | Decorator Pattern in Ruby | Decorator Pattern Ruby Example |
Swift | Decorator Pattern in Swift | Decorator Pattern Swift Example |
Objective-C | Decorator Pattern in Objective-C | Decorator Pattern Objective-C Example |