Motivation

10 things you need to overcome to be successful. Procrastination – Just remind yourself the more fear you feel about a specific task, the more certain you can be that task is important to you and your growth. Limiting beliefs of others – That’s too hard, that won’t work… Remember, if everyone listened to the […]

Composite

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: http://www.cs.unc.edu/~stotts/GOF/hires/pat4cfso.htm) Typical Composite Object structure: 3. Pros It makes it easy […]

Bridge

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 […]

Proxy

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 […]

Prototype

1. Usage Pool of prototypical instances copying them-self to create new copy of objects. Reason can be expensive usage of new() command. Also such approach hide complexity. 2. UML class diagram 3. Pros Adding and removing products at run-time. Specifying new objects by varying values. Specifying new objects by varying structure. Reduced sub-classing. Configuring an […]

Abstract Factory

1. Usage When required to create family of related objects, and they should be easily changed to another family of related objects at run-time we use Abstract Factory; 2. UML class diagram 3. Pros – related objects grouped together; – easy switch at runtime between families of objects; – making uniform way of working with […]