Design Patterns

Design Patterns

Gang of Four patterns split into creational, structural, and behavioral.

1 min readDesigns · LLD & Patterns

22 patterns from the Gang of Four book, organized by intent.


Picking the Right Pattern

SymptomReach for
if/else cascade selecting an algorithmStrategy
Many optional constructor parametersBuilder
Need exactly one shared instanceSingleton
Object behavior changes with internal stateState
Adding cross-cutting features (logging, retry, cache)Decorator
Bridging incompatible interfacesAdapter
Tree of nested objects, treat them uniformlyComposite
Notify many dependents of a state changeObserver
Undo/redo, queue, replayCommand
Hide a complex subsystemFacade
Family of related objects (UI theme, DB driver)Abstract Factory
Two orthogonal axes of variationBridge
Millions of similar objects, save memoryFlyweight
Multiple handlers for one requestChain of Responsibility
Skeleton algorithm with overridable stepsTemplate Method

Finished reading?

Mark it done to track your progress in Designs.