Tidbit

Design Patterns

The classic Gang of Four patterns visualised with UML diagrams and annotated code. Creational, structural, and behavioural patterns in one place.

23 conceptsInteractive diagrams
Abstract Factory
Creates families of related objects without specifying their concrete classes.
Builder
Constructs complex objects step-by-step, separating construction from representation.
Factory Method
Defines an interface for creating an object but lets subclasses decide the type.
Prototype
Creates new objects by cloning an existing prototype instance.
Singleton
Ensures a class has only one instance and provides a global access point to it.
Adapter
Converts the interface of a class into another interface clients expect.
Bridge
Decouples an abstraction from its implementation so they can vary independently.
Composite
Composes objects into tree structures to represent part-whole hierarchies.
Decorator
Attaches additional responsibilities to an object dynamically without subclassing.
Facade
Provides a simplified interface to a complex subsystem.
Flyweight
Shares common state among many fine-grained objects to reduce memory usage.
Proxy
Provides a surrogate that controls access to another object.
Chain of Responsibility
Passes a request along a chain of handlers until one handles it.
Command
Encapsulates a request as an object, enabling undo, queuing, and logging.
Interpreter
Defines a grammar and an interpreter for a simple language.
Iterator
Provides a way to access elements of a collection sequentially without exposing its representation.
Mediator
Defines an object that encapsulates how a set of objects interact.
Memento
Captures and restores an object's internal state without violating encapsulation.
Observer
Defines a one-to-many dependency so dependents are notified on state change.
State
Allows an object to alter its behaviour when its internal state changes.
Strategy
Defines a family of algorithms, encapsulates each, and makes them interchangeable.
Template Method
Defines the skeleton of an algorithm, deferring some steps to subclasses.
Visitor
Lets you add further operations to objects without modifying them.