Bridge Design Pattern

What is Bridge design pattern? The Bridge Design Pattern is used when there is one set of classes (abstraction) that define features and another set of classes (implementation) that provide the implementation for that features. You then ‘add’ a bridge by injecting the base of the implementation hierarchy to the base of the abstraction hierarchy. […]

Template Pattern – Tutorial and example

Template pattern is a behavioral pattern that allows part of an algorithm to vary independent of the rest of the algorithm. In other words, the bulk of the algorithm logic is defined in a base class (could be abstract) and the part that can change is defined in a derived class. Each derived class can […]

Observer Pattern – Description and Example

The Observer pattern is such a popular design pattern that the jdk has provided a set of classes that make it easy to implement it. Here’s how we define the pattern : An Observer pattern allows multiple objects to “observe” or “listen to” the changes in one object. To explain the Observer pattern lets use […]

Strategy Design Pattern

This tutorial looks at the Strategy Design Pattern which is defined as – “groups of encapsulated algorithms that can be used interchangeably”. It is one of the design patterns popularized in the Design Patterns book by ‘Gang of Four’. Strategy Design pattern is a behavioral pattern. We will look at various aspects of the Strategy […]

Builder Design Pattern

In the earlier tutorials we have seen the factory method and the abstract factory pattern. In this tutorial we look at another creational pattern called the Builder Design pattern. The Builder Design pattern specifies a builder class that creates multiple objects in a step by step manner. The client uses the builder to build the […]

Composite Design Pattern

The Composite Design pattern is a structural pattern that defines a way to access a group of objects through a single object. It can be though of as a tree structure where a node holds reference to its children. The main actors in these pattern are Node The Node defines an interface that each object […]

Facade Pattern

What is Facade Pattern The Facade pattern is a structural pattern that provides an entry point to a subsystem of classes. It provides a simpler interface to one or more interfaces. The salient points of a facade pattern are : A facade hides the complexity of a subsystem by providing an interface that is easy […]

Decorator Design Pattern

Decorator Design pattern provides a way to add additional functionality to an object without modifying it. The additional functionality is added to the object at runtime and it does not require extending the class. Decorators have the same interface as the object they are decorating. Their purpose is to provide additional features at runtime and […]

Adapter Design Pattern – Tutorial and Example

What is Adapter Design Pattern The Adapter Design pattern is use when a client expects interfaceA but is provided with interfaceB. The adapter maps the methods from interfaceB to interfaceA. This pattern is used when the client expects certain methods in an interface or class(adaptee) but the adaptee does not provide those methods (Note that […]

Singleton Pattern

This is the last of the creational patterns. In the earlier tutorials we have seen the factory method, the abstract factory pattern, the builder pattern and the prototype pattern. In this tutorial we will look at the Singleton pattern. The singleton pattern ensures that only once instance of a class is created and the client […]

Scroll to top