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
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
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
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 purpose of the builder pattern is to simplify the construction of complex objects, providing us a method to create different representations by using the same construction process. It’s not uncom
Enum Singletons are probably the most secure way to implement this pattern in Java and are also much easier to write. By default, enums are themselves singletons and thread safe in Java, so this is a
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
When we arrive to the world of object oriented programming (OOP), one of the first terms we encounter is design patterns. Design patterns are important stuff, and we really need to understand them. A
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