Builder – Creational patterns

Builder provide a flexible design solution – how we can create a class and how we can simplified (and reduce parameters count passed to the constructor) instantiation process of the class:

  disadvantages: Requires creating a separate ConcreteBuilder for each different type of product. Requires the builder classes to be mutable. Data members of […]

Singleton – Creational patterns

Restricts the instantiation of a class to one object. Should be created on demand. Static field (simple, thread safe, no lazy init, no exception handling):

Enum (thread safe, no lazy init)

Lazy init, exception handling, hight performance, since Java 1.5 volatile

On demand holder

  Creational patterns: Singleton ¦ Builder ¦ Factory Method ¦ Abstract Factory ¦ […]