All Patterns
Every pattern has a plain-English explanation, a diagram, code examples, and interview prep built in.
Explore patterns with diagrams, analogies, and Java examples.
Creational Patterns
How objects are created
Singleton
Ensure a class has only one instance, and provide a global point of access to it.
Factory
Define an interface for creating objects, but let subclasses decide which class to instantiate.
Abstract Factory Pattern
Create families of related objects without specifying concrete classes
Builder Pattern
Separate construction from representation
Prototype Pattern
Create objects by cloning an existing prototype
Structural Patterns
How objects are composed
Adapter Pattern
Convert incompatible interfaces into compatible ones
Bridge Pattern
Decouple abstraction from implementation so they can vary independently
Composite Pattern
Compose objects into tree structures to represent hierarchies
Decorator Pattern
Add responsibilities to objects dynamically
Facade
Provide a simplified interface to a complex subsystem of classes.
Flyweight Pattern
Share fine-grained objects efficiently to reduce memory usage
Proxy Pattern
Control access to another object through a surrogate
Behavioral Patterns
How objects communicate
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
Command
Encapsulate a request as an object, allowing you to parameterize clients with different requests, queue them, and log them
Iterator
Provide a way to access the elements of an object sequentially without exposing its underlying representation
Mediator
Define an object that encapsulates how a set of objects interact
Memento
Capture and externalize an object's internal state without violating encapsulation, allowing it to be restored later
Observer
Define a one-to-many dependency where when one object changes state, all its dependents are notified automatically
State
Allow an object to alter its behavior when its internal state changes
Strategy
Define a family of algorithms, encapsulate each one, and make them interchangeable
Template Method
Define the skeleton of an algorithm in a base class, deferring some steps to subclasses
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
AI Agent & LLM Patterns
How LLMs reason, act, and collaborate
RAG
Ground LLM responses in real data by retrieving relevant documents before generating an answer.
Chain of Thought
Break down complex problems into step-by-step reasoning to improve answer quality.
ReAct
Combine reasoning and action: think through steps and execute tools to solve tasks.
Tool Use
Enable LLMs to call functions and external tools to expand their capabilities.
Multi-Agent
Coordinate multiple specialized agents working together to solve complex problems.
Reflection
Generate, critique, and refine outputs iteratively to improve quality.
Memory
Maintain context across interactions using short-term and long-term memory systems.
Guardrails
Validate inputs and outputs to ensure safety, quality, and compliance.
ML System & MLOps Patterns
How production ML systems are built
Feature Store
Centralize feature computation, storage, and serving so training and inference always use the exact same data.
Model Registry
A versioned catalog of trained ML models with metadata, lineage, and stage transitions from staging to production.
Training Pipeline
Automated, reproducible workflows that ingest data, train models, evaluate them, and register successful runs.
Serving Pipeline
Deploy ML models behind a scalable, low-latency API that handles feature lookup, prediction, and response transformation.
Data Versioning
Track datasets like code with immutable versions so any model run can be reproduced months later.
Model Monitoring
Continuously track model performance, input distributions, and prediction drift to catch silent failures in production.
A/B Testing
Safely roll out new models by routing a fraction of traffic to the candidate and comparing business metrics against the control.