Back to Low-Level Design
🏗️
Phase 2

Creational Design Patterns

Patterns for object creation. Not just how to instantiate objects, but how to decouple your system from the specifics of what gets created, how it gets created, and when.

1

Singleton Pattern: Thread-Safe Implementations and When to Avoid It

Every thread-safe Singleton implementation in Java — double-checked locking, the static holder idiom, and enum singleton — plus why the pattern is the most abused tool in OOP and when dependency injection should replace it.

lldcreationalsingleton
2

Monostate Pattern: Shared Behavior Without a Single Instance

The Monostate (Borg) pattern shares state across every instance via static fields instead of restricting instantiation — an under-taught alternative to Singleton that plays better with inheritance and polymorphism.

lldcreationalmonostate
3

Factory Method Pattern: Deferring Instantiation to Subclasses

How Factory Method decouples client code from concrete classes by letting subclasses decide what to instantiate — with parameterized factories, Template Method integration, and the line where factory proliferation becomes a smell.

lldcreationalfactory
4

Abstract Factory Pattern: Creating Families of Related Objects

How Abstract Factory guarantees consistency across families of related objects — GUI widget kits, database driver families — and why it costs an interface change every time a new product kind is added.

lldcreationalabstract-factory
5

Builder Pattern: Fluent Construction Without Telescoping Constructors

How the Fluent Builder idiom replaces telescoping constructors and mutable JavaBeans, with mandatory-parameter enforcement, immutable build() results, and the step-builder trick for order-sensitive construction.

lldcreationalbuilder
6

Prototype Pattern: Cloning Instead of Constructing

Creating new objects by copying existing ones instead of building from scratch — deep vs shallow cloning, why Java's Cloneable is broken, copy constructors, and the prototype registry.

lldcreationalprototype