Proxy vs Observer design pattern

The Proxy design pattern allows to define a “proxy” class which will act as a wrapper object which will be called by the client to access the product object without exposing the details. This proxy class can also be used to add extra functionality without changing the product behavior. This design pattern can be used in cases to provide additional security access to an existing product or providing an interface for remote resources. General class diagram of proxy pattern is shown below.

(more…)
Proxy vs Observer design pattern Read More

Visitor Design Pattern explained with simple example

The visitor design pattern allows a programmer to separate algorithms of the module from the object or class. This will allow to modify algorithm by adding or removing new functionalities without altering objects structure. This design pattern basically allows us to add a functionality to every element without altering their structure.

Before going ahead have a look at Design pattern simplified version.

(more…)
Visitor Design Pattern explained with simple example Read More

State Design Pattern explained with simple example

State design pattern allows an object to change its behaviour whenever its state changes. This design pattern is very similar to state machines in which behaviour of an object based on an event is dependent on the its state. This design pattern makes the software easily extensible as adding new states are quite easy because it doesn’t affect the behaviour of existing states.

Before going ahead have a look at Design pattern simplified version.

(more…)
State Design Pattern explained with simple example Read More

Observer Design Pattern explained with simple example

Observer design pattern is one of the most famous and widely used design pattern in software industry. In this design pattern basically multiple objects which are called as observers, registers themselves to an object called as subject for getting automatic notifications, whenever any state changes occurs in subject. This is mainly used for event handling modules.

Before going ahead have a look at Design pattern simplified version.

(more…)
Observer Design Pattern explained with simple example Read More

Memento Design Pattern explained with simple example

The Memento design pattern basically stores the various states of the system and provides the ability to restore the system in some previous state. This design pattern allows software to storing store various state which can be used for retracing or can be used to go back to some previous state in case something goes wrong. Also, auditing related procedures also can be done using this design pattern.

Before going ahead have a look at Design pattern simplified version.

(more…)
Memento Design Pattern explained with simple example Read More

Mediator Design Pattern explained with simple example

Mediator design pattern basically defines an interface class which provides a mechanism for providing communication between various modules/components of the software. Since, mediator needs to access each component of the software, which means it should be added as a reference in each component. Using this mediator class components becomes less dependent on each other which means coupling is reduced.

Before going ahead have a look at Design pattern simplified version.

(more…)
Mediator Design Pattern explained with simple example Read More

Iterator Design Pattern explained with simple example

An iterator is an object which allows a developer to easily traverse through a container class. The Iterator design pattern is relatively simple and easy to implement kind of design pattern in which an iterator is used to traverse through a complex container in order to access the elements of the container. This design pattern tries to decouple container classes from the other modules in order to achieve low coupling.

Before going ahead, have a look at Design pattern simplified version.

(more…)
Iterator Design Pattern explained with simple example Read More

Interpreter Design Pattern explained with simple example

Interpreter design pattern is mainly used in compiler and other language processing programs. This design pattern used to identify various language mainly textual such as numbers, regular expression etc. This design pattern interprets every language syntax and assign a class accordingly, to do further processing.

Before going ahead have a look at Design pattern simplified version.

(more…)
Interpreter Design Pattern explained with simple example Read More