Adapter design pattern (wrapper)
We talked about the Facade design pattern yesterday which provides a wrapper over a sub-system (or a set of functionality. Adapter design pattern also provides a wrapper over the functionality of a class, the difference is that Adapter convert the interface of a class into another interface which clients expect. Adapter, the structural design pattern, […]
Facade design pattern
Facade is a structural design pattern. It defines a higher-level interface that makes the subsystem easier to use. Facade means the mask (मुखौटा) and the pattern is nothing but a simplified interface to a more complex system by providing a wrapper for the sub-system. Consider starting your car, let us see what happens under the hood […]
Multiton design pattern
Multiton is a Creational design pattern. It is just an extension of Singleton Pattern. Singleton allows creation of only one object of the class. The constructor is made private and objects are created only thru a static function which returns instance of the object. When this function is called first time, a new object of […]
Object pool design pattern
Have you gone to bowling ? You have to change your shoes before actually get to the bowling arena. There are lot of shoes in the shoe-shelf, you just need to pick the shoe that fits you, put it on and start playing. Once you are done, you return the shoes to the shelf, put […]
Prototype Design Pattern
Think of an Interior decorator. He will be performing the below two steps to suggest the decoration of interior to any client: For each client that comes to the designer, he will do the above two steps. The second step (designing the hall) is customized according to requirements of the client, but first step (creating […]
Builder Design Pattern
Let’s understand it by understanding the assembling of computer. When you buy computer (in India), you have two choices, Buy the entire computer from a manufacturer (like HP or Dell), the way we buy laptops, or, Get it assembled. For this post, we are only interested in the second option. When you are assembling your […]
Abstract Factory Design Pattern
Abstract Factory is an extension to Factory Design Pattern discussed earlier. In fact the last method discussed in that post is nothing but an example of Abstract Factory design. If the product being produced in the factory requires to set up a separate factory (for a particular product) itself, then the case is fit for Abstract […]
Factory Design Pattern
The Factory design pattern is an object-oriented Creational design pattern. It implements the code to allow creation of objects the way products are created in factories. The essence of this pattern is to “Define an interface for creating an object, but let the classes that implement the interface decide which class to instantiate. Hence, deferring (postponing) the instantiation […]
Open Close Principle
The Open Close Principle in Programming says “Software entities like Classes, Functions, Modules should be open for extension, but closed for modification.” It encourages programmers to write code in such a way that new functionality can be added without changing the existing code. i.e If we are writing a class, then we may later, extend […]
Singleton design pattern
Singleton patterns are used, when you want to allow creation of only one instance(object) of a particular class. Such classes (which allow only single object to be created) are called Singleton Classes. For example, there is only one Window manager, so a class implementing Windows Manager, should be allowed to be instantiated only once.