Home » Tag Archives: Design Patterns

Tag Archives: Design Patterns

Creational Design Patterns: Prototype Pattern

The prototype pattern is used in order to create a copy of an object. This pattern can be really useful especially when creating an object from scratch is costly. In comparison with the builder, factory and abstract factory patterns it does not create an object from scratch it clones/recreates it. In comparison with the singleton pattern it creates multiple copies ...

Read More »

Creational Design Patterns: Singleton Pattern

The singleton design pattern is a software design pattern the restricts the the instantiation of a class to one object. In comparison with other creational design patterns such as the abstract factory, factory and the builder pattern the singleton will create an object but will also be responsible so that only one instance of that object exists. When creating a ...

Read More »

Creational Design Patterns: Builder Pattern

Previously we had a look at the factory and the abstract factory pattern. Those patterns serve their purpose and can be really useful however there are use cases where we have to create a very complex object and creating it requires different steps each one requiring different actions. In such cases the builder pattern can be really useful. The builder ...

Read More »

Creational Design Patterns: Factory Pattern

Previously we had an introduction to the Creational Patterns and used the Abstract Factory Pattern in order to create a families of objects. The next pattern is the Factory Pattern. Factory pattern is one of the most used patterns when it comes to Java. So what is the Factory Pattern all about? The factory pattern deals with creating objects without ...

Read More »

Creational Design Patterns: Abstract Factory Pattern

The Abstract Factory Pattern is a creational pattern and is one of the most popular patterns along with the builder and the factory pattern. Creational patterns are used in order to create objects instead of creating objects directly using a constructor. The Abstract Factory Pattern provides a way to encapsulate a group of individual factories that have a common theme ...

Read More »

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

java-interview-questions-answers

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

spring-interview-questions-answers

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 »