All Patterns

Every pattern has a plain-English explanation, a diagram, code examples, and interview prep built in.

0 / 37 learned

Explore patterns with diagrams, analogies, and Java examples.

Creational Patterns

How objects are created

5 patterns

Structural Patterns

How objects are composed

7 patterns

Behavioral Patterns

How objects communicate

10 patterns
behavioralintermediate

Chain of Responsibility

Pass a request along a chain of handlers. Each handler decides either to process the request or pass it along the chain

handler-chainrequest-passing
6 min read
behavioralintermediate

Command

Encapsulate a request as an object, allowing you to parameterize clients with different requests, queue them, and log them

encapsulationundo-redo
6 min read
behavioralbeginner

Iterator

Provide a way to access the elements of an object sequentially without exposing its underlying representation

sequential-accessencapsulation
5 min read
behavioralintermediate

Mediator

Define an object that encapsulates how a set of objects interact

centralized-controldecoupling
6 min read
behavioralintermediate

Memento

Capture and externalize an object's internal state without violating encapsulation, allowing it to be restored later

state-captureundo-redo
6 min read
behavioralbeginner

Observer

Define a one-to-many dependency where when one object changes state, all its dependents are notified automatically

event-drivenpublish-subscribe
4 min read
behavioralintermediate

State

Allow an object to alter its behavior when its internal state changes

state-machinebehavior-modification
6 min read
behavioralbeginner

Strategy

Define a family of algorithms, encapsulate each one, and make them interchangeable

interchangeablealgorithms
5 min read
behavioralbeginner

Template Method

Define the skeleton of an algorithm in a base class, deferring some steps to subclasses

algorithm-structureinheritance
5 min read
behavioraladvanced

Visitor

Represent an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates

double-dispatchoperation-separation
7 min read

AI Agent & LLM Patterns

How LLMs reason, act, and collaborate

8 patterns

ML System & MLOps Patterns

How production ML systems are built

7 patterns