Design patterns describe recurring software design problems and their solutions. These articles explain the principles behind commonly used design patterns and provide sample implementations in C++. Design patterns are independent of any programming language and the principles described in these articles could be used to implement in any programming language of choice.
This article gives a basic introduction to design patterns and talks about the classification of design patterns namely creational design patterns, structural design patterns and behavioral design patterns.
Singleton is the simplest of creational design patterns. Singleton design pattern is a template to provide one and only instance of an object.
Factory design pattern is a creation design pattern to localize the object creation code and prevents disturbing the entire system for a new type introduction.
Observer design pattern is a behavioral design pattern and used to notify multiple objects of a change to keep them in sync like Model-View-Controller (MVC) concept.
Template design pattern is a behavioral design patter. In the template pattern, parts of program which are well defined like an algorithm are defined as a concrete method in the base class. The specifics of implementation are left to the derived classes by making these methods as abstract in the base class.
Chain of Responsibility is a behavioral design pattern. The basic idea behind this pattern is that a request or a command passes through a chain of objects until it is handled.
Command pattern is a behavioral design pattern where the command or request is encapsulated and treated as a object. This article talks about the various classes participating in a command design pattern.
Adapter pattern is a structural design pattern. Also referred as wrapper pattern. An adapter design pattern allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface.
The visitor design pattern is a structural design pattern and allows the separation of data structures and algorithms from the data itself.
Facade design pattern is a structural design pattern. Makes an existing complex software library easier to use by providing a simpler interface for common tasks.
Builder design pattern in useful when you want to build a complex object. Intent of this pattern is to separate the construction of object from its representation.
Composite design pattern is useful when you want to treat a group of objects in the same manner as a single instance of the object. The objects grouped, themselves could be in composite manner in a tree fashion.
Decorator design pattern is useful when you want to add capabilities (statically or dynamically) to an object without sub-classing the concrete object's class as well as not affecting other objects of the same concrete class.