Home » Design Patterns » Page 3

Tag Archives: Design Patterns

Behavioural Design patterns: Observer

Observer is one of the most popular design patterns. It has been used a lot on many software use cases and thus many languages out there provide it as a part of their standard library. By using the observer pattern we can tackle the following challenges. Dependency with objects defined in a way that avoids tight coupling Changes on an ...

Read More »

Behavioural Design patterns: Memento

The memento pattern is all about state. You use it when you want to restore the object to its previous state. You have an object, you apply some actions and you are able to revert those actions and get the object in the various states it has been before. Most of us implement various algorithms and sometimes we do need ...

Read More »

Behavioural Design Patterns: Mediator

Previously we had a look at the iterator pattern. The mediator pattern is way different on what it tries to achieve. It is one of the behavioural patterns and its purpose is to alter the way objects communicate with each other. Instead of the objects communicating with each other directly the mediator will handle the objects interaction. For example imagine ...

Read More »

Multilevel Adapter Pattern

Intro This post continues my “new pattern ideas” series. I’ll describe a special version of the adapter pattern that can guarantee several levels of access to objects. In particular I’ll show 3 main levels – read, write and class access. Motivation We’ll consider a 2-tiered system: The top tier consists of object folders. Every folder contains objects of one type ...

Read More »

Behavioural Design Patterns: Iterator

The iterator pattern is one of the most used patterns from the behavioural ones. Most of the times you use it without even noticing it. Supposing you have a container with elements and you want to traverse them. Iterating the elements might differ based on the container, retrieval method etc. By using the iterator pattern we can decouple the algorithms ...

Read More »

Behavioural Design Patterns: Interpreter

Previously we had a look at the chain of responsibility and the command pattern. They do tackle different problems however they both delegate an action to another component, the command patterns always delegates the action, the chain of responsibility if the action cannot be handled it will be forward it to its successor. We are going to switch context and ...

Read More »

Behavioural Design Patterns: Command

Previously we used the Chain of Responsibility pattern in order to handle a complex problem with road incidents in a region, solving the problem in the first place or forwarding it to another incident handler. The command pattern is quite different to the cor pattern since it helps us in order to delegate an action/request to another object capable of ...

Read More »

Behavioural Design Patterns: Chain of Responsibility

We had a look on creational design patterns and structural design patterns. On this blog we will focus on behavioural design patterns. From wikipedia Behavioural design patterns are design patterns that identify common communication patterns between objects and realise these patterns. By doing so, these patterns increase flexibility in carrying out this communication. Creational design patterns realise the creation of ...

Read More »

Structural Design Patterns: Proxy Pattern

Previously we used the facade pattern in order to interact with a legacy application. Our next pattern would be the proxy pattern. The proxy pattern is used when we want Control the access to an object Add extra functionality when accessing an object. One of the most common usages is when we want to monitor specific actions and add some ...

Read More »