KNOWLEDGE BASE

Patterns

Design patterns and architectural blueprints for solving common engineering challenges. Reusable solutions that stand the test of time.

52Patterns
884Curated Resources

Abstract Factory

Provides an interface for creating families of related or dependent objects without specifying their concrete classes. Used when a system needs to be independent of how its objects are created.

17 resourcesExplore →

Adapter

Allows objects with incompatible interfaces to collaborate. Acts as a wrapper between two interfaces, converting the interface of a class into another interface clients expect.

17 resourcesExplore →

Ambassador

Creates a helper service that handles cross-cutting concerns like retries, circuit breaking, and authentication on behalf of a client service.

17 resourcesExplore →

B-Tree

A self-balancing tree data structure that maintains sorted data and enables efficient insertion, deletion, and search operations. The standard index structure in relational databases.

17 resourcesExplore →

Bloom Filter

A space-efficient probabilistic data structure for testing whether an element is a member of a set. Can return false positives but never false negatives. Used in caching and spell checkers.

17 resourcesExplore →

Bridge

Decouples an abstraction from its implementation so that the two can vary independently. Used when both the abstraction and implementation may have multiple variations.

17 resourcesExplore →

Builder

Separates the construction of a complex object from its representation, allowing the same construction process to create different representations. Ideal for objects with many optional parameters.

17 resourcesExplore →

Chain of Responsibility

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

17 resourcesExplore →

Circuit Breaker

Prevents an application from repeatedly trying to execute an operation that is likely to fail. Opens the circuit to fail fast and allows recovery time for the downstream service.

17 resourcesExplore →

Command

Encapsulates a request as an object, allowing parameterization of clients with queues, requests, and operations. Supports undoable operations and logging.

17 resourcesExplore →

Composite

Composes objects into tree structures to represent part-whole hierarchies. Lets clients treat individual objects and compositions uniformly.

17 resourcesExplore →

Consistent Hashing

A distributed hashing scheme that minimizes key redistribution when the number of nodes changes. Used by DynamoDB, Cassandra, and CDNs for data partitioning.

17 resourcesExplore →

CQRS

Separates read and write operations into different models. Commands handle writes, queries handle reads — often with different data stores optimized for each purpose.

17 resourcesExplore →

Decorator

Attaches additional responsibilities to an object dynamically. Provides a flexible alternative to subclassing for extending functionality.

17 resourcesExplore →

Event Sourcing

Stores the state of a system as a sequence of events rather than the current state. Enables full auditability, time travel, and complex event processing.

17 resourcesExplore →

Facade

Provides a unified interface to a set of interfaces in a subsystem. Defines a higher-level interface that makes the subsystem easier to use.

17 resourcesExplore →

Factory Method

Defines an interface for creating an object, but lets subclasses decide which class to instantiate. Promotes loose coupling by deferring object creation to subclasses.

17 resourcesExplore →

Fanout

Distributes incoming messages or tasks to multiple workers or queues for parallel processing. Widely used in data pipelines and event-driven architectures.

17 resourcesExplore →

Flyweight

Uses sharing to support large numbers of fine-grained objects efficiently. Reduces memory usage by sharing common parts of state between multiple objects.

17 resourcesExplore →

Gossip Protocol

A peer-to-peer communication protocol where nodes periodically exchange state information with random peers. Used for failure detection in distributed systems like Cassandra and Consul.

17 resourcesExplore →

Hash Index

An index structure that uses a hash function to map keys to bucket locations. Provides O(1) lookup for equality queries but does not support range queries.

17 resourcesExplore →

Interpreter

Given a language, defines a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.

17 resourcesExplore →

Iterator

Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. Supports multiple traversals.

17 resourcesExplore →

Leader-Follower

A thread coordination pattern where one thread (leader) waits for events while others (followers) process them. The leader promotes a follower upon receiving an event.

17 resourcesExplore →

LRU Cache

Evicts the least recently used items when the cache reaches capacity. Combines a hash map for O(1) lookups with a doubly-linked list for efficient eviction tracking.

17 resourcesExplore →

LSM Tree

A data structure optimized for write-heavy workloads. Maintains data in a series of immutable sorted files merged in the background. Used by LevelDB, RocksDB, and Cassandra.

17 resourcesExplore →

MapReduce

A programming model for processing large datasets in parallel across distributed clusters. Consists of a Map step (filter/sort) and a Reduce step (summarize/aggregate).

17 resourcesExplore →

Mediator

Defines an object that encapsulates how a set of objects interact. Promotes loose coupling by preventing objects from referring to each other explicitly.

17 resourcesExplore →

Memento

Captures and externalizes an object's internal state so that the object can be restored to this state later. Supports undo and rollback operations.

17 resourcesExplore →

Multi-Leader Replication

A database replication strategy where multiple nodes accept writes and replicate changes to each other. Useful for multi-datacenter deployments and offline-first applications.

17 resourcesExplore →

MVC

Separates an application into three interconnected components: Model (data), View (UI), and Controller (business logic). The dominant pattern for web frameworks.

17 resourcesExplore →

MVCC

Multi-Version Concurrency Control allows concurrent access to a database by keeping multiple versions of each data item. Readers see a consistent snapshot without blocking writers.

17 resourcesExplore →

MVVM

Extends MVC by separating the View from its backing data using a ViewModel that exposes data and commands. Popular in modern UI frameworks like Angular, Vue, and WPF.

17 resourcesExplore →

Observer

Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

17 resourcesExplore →

Paxos

A consensus algorithm that enables a distributed system to agree on a single value despite failures. Foundational to distributed consensus and leader election.

17 resourcesExplore →

Prototype

Creates new objects by copying an existing object, known as the prototype. Useful when object creation is expensive and you want to avoid subclasses.

17 resourcesExplore →

Proxy

Provides a surrogate or placeholder for another object to control access to it. Useful for lazy loading, access control, logging, and caching.

17 resourcesExplore →

Publish-Subscribe

A messaging pattern where senders (publishers) send messages without knowing the receivers (subscribers). Decouples components through a message broker.

17 resourcesExplore →

Raft

A consensus algorithm designed to be more understandable than Paxos. Uses leader election and log replication to achieve consensus in distributed systems. Powers etcd and Consul.

17 resourcesExplore →

Replication

The process of maintaining copies of data across multiple nodes. Provides fault tolerance, high availability, and improved read performance in distributed systems.

17 resourcesExplore →

Repository

Mediates between the domain and data mapping layers, acting like an in-memory domain object collection. Centralizes data access logic and improves testability.

17 resourcesExplore →

Retry Pattern

Enables an application to retry a failed operation in anticipation of transient failures. Often combined with exponential backoff and jitter to avoid overwhelming the downstream service.

17 resourcesExplore →

Saga

Manages distributed transactions by breaking them into a sequence of local transactions with compensating actions for rollback. Essential for microservices.

17 resourcesExplore →

Sharding

Partitions a large database into smaller, faster, more manageable parts called shards. Each shard holds a subset of data and can be managed independently.

17 resourcesExplore →

Sidecar

Deploys auxiliary components (logging, monitoring, networking) as a separate container alongside the main application container. Common in service mesh architectures.

17 resourcesExplore →

Singleton

Ensures a class has only one instance and provides a global point of access to it. Commonly used for logging, driver objects, caching, and thread pools.

17 resourcesExplore →

State

Allows an object to alter its behavior when its internal state changes. The object will appear to change its class at runtime.

17 resourcesExplore →

Strangler Fig

Incrementally replaces a legacy system by building a new system alongside it and gradually routing functionality from the old to the new, eventually decommissioning the old.

17 resourcesExplore →

Strategy

Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Lets the algorithm vary independently from clients that use it.

17 resourcesExplore →

Template Method

Defines the skeleton of an algorithm in a method, deferring some steps to subclasses. Lets subclasses redefine certain steps without changing the algorithm's structure.

17 resourcesExplore →

Two-Phase Commit

A distributed transaction protocol that ensures all participating nodes either commit or abort a transaction. Provides atomicity across multiple databases or services.

17 resourcesExplore →

Visitor

Represents an operation to be performed on elements of an object structure. Lets you define a new operation without changing the classes of the elements.

17 resourcesExplore →