1. Usage Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. [GoF, p175] Client-specified embellishment of a core object by recursively wrapping it. Wrapping a gift, putting it in a box, and wrapping the box. 2. UML class diagram 3. Pros Decorators provide a flexible alternative to […]


1. Usage Composite is composing tree like structures as single object(container), and let clients to go through such composed objects and regular objects uniformly. Qt Library has implicit support of Composite pattern due to ability to SetParent of QObject. 2. UML class diagram (source: Typical Composite Object structure: 3. Pros It makes it easy […]


1. Usage Kind of “2D Abstraction” (or by Rumbaugh “nested generalizations”) both on Interface(Window in example below) and on Implementation(WindowImp). So both Abstraction and Implementation should be extensible by sub-classing.Another name for this pattern is Handle-Body.This Pattern often used in Window Libraries e.g. AWT. Qt library uses this pattern for switching Style at run-time. Reasons […]


1. Usage Proxy pattern in general is Wrapper. Sometimes its hard/impossible to modify real object. For client using Proxy object should be same like using real object as they share same interface. Consider following usage scenarios: Remote Proxy – in distributed communication we create local proxy object which hide all communication with remote object Virtual […]