Home » Tag Archives: Design Patterns

Tag Archives: Design Patterns

Isolating the Domain Logic

In one design patterns class, I had an interesting discussion about modelling domain logic. Specifically, it was about isolating the domain logic. An application would typically be divided into three parts: Presentation (e.g. desktop GUI, browser, web service) Domain logic Infrastructure (e.g. persistence storage, e-mail) The class found it interesting that the dependency arrows were pointing towards the domain logic ...

Read More »

Resource leakages: command pattern to the rescue


Over the years of performance monitoring with Plumbr I have faced hundreds of performance issues caused by resource leakages. In this post I would like to describe one of the simplest ways to approach resource clean-up and avoid the problem. Let me first describe the problem by using a movie player application as an example. The primary feature for such an ...

Read More »

Introducing The Delegate Pattern


Delegate: a person who is chosen or elected to vote or act for others – Merriam-Webster. Delegate pattern: In software engineering, the delegation pattern is a design pattern in object-oriented programming where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object – Wikipedia. Make things as simple as possible, but not simpler – Albert ...

Read More »

The Best of Both Worlds

Type-Safe Views using Abstract Document Pattern How do you organize your objects? In this article I will introduce a pattern for organizing so called noun-classes in your system in a untyped way and then expose typed views of your data using traits. This makes it possible to get the flexibility of an untyped language like JavaScript in a typed language ...

Read More »

Abstract Factory or Factory Method?

Today I would like to tell you about Factory Method Pattern and Abstract Factory Pattern. The purpose of the article is to help you recognize places where one of them should be used. What will we talk about? Those patterns are one of the Creational Patterns and as the name suggest their main responsibility is creating the objects. However, we ...

Read More »

Java Dynamic Proxy

Proxy is a design pattern. We create and use proxy objects when we want to add or modify some functionality of an already existing class. The proxy object is used instead of the original one. Usually the proxy objects have the same methods as the original one and in Java proxy classes usually extend the original class. The proxy has a ...

Read More »

Java 8 Lambda Expression for Design Patterns – Strategy Design Pattern

The strategy pattern defines a family of algorithms encapsulated in a driver class usually known as Context and enables the algorithms to be interchangeable. It makes the algorithms easily interchangeable, and provides mechanism to choose the appropriate algorithm at a particular time. The algorithms (strategies) are chosen at runtime either by a Client or by the Context. The Context class ...

Read More »

Decorator Design Pattern using lambdas

With the advent of lambdas in Java we now have a new tool to better design our code. Of course the first step is using streams, method references and other neat features introduced in Java 8. Going forward I think the next step is to revisit the well established Design Patterns and see them through the functional programming lenses. For ...

Read More »

Factory Pattern

The factory pattern is a creational design pattern whose intent is to provide an interface for creating families of related or dependent objects without specifying their concrete classes. The creational logic is encapsulated within the factory which either provides a method for its creation or delegates the creation of the object to a subclass. The client is not aware of ...

Read More »