Category: Good practices

February 14, 2018 / Design patterns

The Builder pattern helps us create complex objects that can have different representations, simplifying the process and (optionally) preserving immutability – encapsulating the code responsible for assembling an object in a separate Builder class.

In simpler terms, it delegates the responsibility of creating a complex object to its Builder, whose job it is to make sure that the object is never created in an invalid state.

December 6, 2017 / Design patterns

In the simplest terms, a factory method is a method which creates objects and lets a class defer instantiation to its subclasses.

It may either be implemented directly in a class (and optionally overriden in its children) or specified in an interface (and implemented by classes which use it).

May 16, 2017 / Design patterns

The abstract factory pattern provides an interface for creating related objects, while hiding the choice of their concrete classes in implementations of that interface.