Category

Behavioral

Patterns that focus on communication between objects, defining how objects interact and distribute responsibility.

schema

Core Patterns

10

code

Implementations

100

verified

Avg. Reliability

—

Coming Soon
Coming Soon
link
intermediate
BehavioralverifiedVerified

Chain of Responsibility

Passes a request along a chain of handlers, where each handler decides to process it or pass it to the next handler in the chain.

Difficulty: intermediatearrow_right_alt
notifications_active
intermediate
BehavioralverifiedVerified

Observer

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

Difficulty: intermediatearrow_right_alt
swap_horiz
beginner
BehavioralverifiedVerified

Strategy

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

Difficulty: beginnerarrow_right_alt
terminal
intermediate
BehavioralverifiedVerified

Command

Encapsulates a request as an object, allowing you to parameterize clients, queue or log requests, and support undoable operations.

Difficulty: intermediatearrow_right_alt
toggle_on
intermediate
BehavioralverifiedVerified

State

Allows an object to alter its behavior when its internal state changes, appearing as if the object has changed its class.

Difficulty: intermediatearrow_right_alt
view_timeline
beginner
BehavioralverifiedVerified

Template Method

Defines the skeleton of an algorithm in a base class, deferring certain steps to subclasses without changing the algorithm's overall structure.

Difficulty: beginnerarrow_right_alt
replay
beginner
BehavioralverifiedVerified

Iterator

Provides a way to sequentially access elements of a collection without exposing its underlying representation.

Difficulty: beginnerarrow_right_alt
hub
intermediate
BehavioralverifiedVerified

Mediator

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

Difficulty: intermediatearrow_right_alt
history
intermediate
BehavioralverifiedVerified

Memento

Captures and externalizes an object's internal state without violating encapsulation, allowing the object to be restored to that state later.

Difficulty: intermediatearrow_right_alt
door_open
advanced
BehavioralverifiedVerified

Visitor

Lets you add new operations to an object structure without modifying the objects themselves, by separating the algorithm from the object structure it operates on.

Difficulty: advancedarrow_right_alt