Adapter

1. Usage Converts interface of one class which required into another interface which can be called. This pattern also knows as Wrapper. Can be useful with Legacy classes which cannot […]

Read More

Singleton

1. Usage Class which has Single Instance and Global access hrough all application. 2. UML class diagram 3. Pros Controlled access to single object. 4. Cons Can be harmful in […]

Read More

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

Read More

Builder

1. Usage To implement reusable mechanize of polymorphic pipeline to generate step by step final complex product. For example function “save as” document – as HTML, RTF, PDF. each plugin […]

Read More

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

Read More

Factory Method

1. Usage “Define an interface for creating an object, but let subclasses decide which class to instantiate. The Factory method lets a class defer instantiation it uses to subclasses.”(Gang Of […]

Read More

Double Dispatch

Recently I was visiting one company and got C++ interview question: What is double dispatch. I studied C++ quite long time ago and that question confused me. Single Dispatch is calling virtual […]

Read More