Category: Design Patterns

Prototype Pattern

Whenever object instantiation implies a high computational cost or an uncertain availability of data, we should consider the possibility of cloning, as it may be cheaper than creating brand new insta

Decorator Pattern

The Decorator allow us to attach additional responsibilities to an object. The concept behind this pattern is not difficult to understand, as long as we have already understood other fundamental conc

Introduction to factories

This post is an introduction to factories, and we will try to implement a very simple situation, that will allow us to better understand what factories do. It’s by no mean the best factory implementa

The eager singleton

As mentioned in this post singletons can be instantiated in two different ways, and one of them is eager instantiation. Bellow we have an example of a class defining a singleton that will be eager in

Singleton-A little theory

Sometimes we need to make sure that we have only one instance of an object throughout the entire life-cycle of an application. There may be many reasons for that, but one of the most commons is to av