Tag Archives: Decorator pattern

Decorator pattern

Sometimes we need to extend an object functionality, a normal way we can do it statically by inheritance mechanism. This is not wrong, but in some situations it makes source code more complex as well. That is reason Decorator pattern, a way of extending functionality dynamically, was born.

According to GoF, Decorator pattern is one of the widely used structure patterns. This pattern dynamically changes the functionality of an existed object at runtime without impacting on the existing functionality of the other objects. Continue reading