Browse

Gang of Four Design Patterns: What They Solve

Match each problem to the classic Gang of Four design pattern that solves it.

Code23 items3 levelsDifficulty 3/5
Start training →

Free · no signup · works on any device

Levels

Start easy — harder levels unlock as you improve, or jump ahead anytime.

1
Creational
5 items
2
Structural
7 items
3
Behavioral
11 items

All 23 cards

Ensure a class has only one instance and provide a single global point of access to it.
Singleton
Define an interface for creating an object, but let subclasses decide which concrete class to instantiate.
Factory Method
Create families of related or dependent objects without specifying their concrete classes.
Abstract Factory
Separate the construction of a complex object from its representation so the same process can create different representations.
Builder
Create new objects by copying (cloning) an existing instance rather than instantiating a class.
Prototype
Convert the interface of a class into another interface that clients expect, letting incompatible interfaces work together.
Adapter
Decouple an abstraction from its implementation so the two can vary independently.
Bridge
Compose objects into tree structures and let clients treat individual objects and compositions uniformly.
Composite
Attach additional responsibilities to an object dynamically without changing its class.
Decorator
Provide a unified, simplified interface to a complex subsystem.
Facade
Use sharing to support large numbers of fine-grained objects efficiently by minimizing memory.
Flyweight
Provide a placeholder or surrogate for another object to control access to it.
Proxy
Pass a request along a chain of handlers until one of them handles it, decoupling sender from receiver.
Chain of Responsibility
Encapsulate a request as an object, allowing it to be queued, logged, parameterized, or undone.
Command
Define a grammar for a language and an interpreter that evaluates sentences in that language.
Interpreter
Provide a way to access elements of a collection sequentially without exposing its underlying representation.
Iterator
Define an object that encapsulates how a set of objects interact, reducing direct coupling between them.
Mediator
Capture and externalize an object's internal state so it can be restored later, without violating encapsulation.
Memento
Notify and update dependent objects automatically when one object changes state (one-to-many dependency).
Observer
Allow an object to alter its behavior when its internal state changes, appearing to change its class.
State
Define a family of interchangeable algorithms, encapsulate each one, and make them swappable at runtime.
Strategy
Define the skeleton of an algorithm in a method, deferring some steps to subclasses.
Template Method
Add new operations to an object structure without modifying the classes of the elements it operates on.
Visitor

Keep going

Big-O Time Complexity of Common Operations & Algorithms

Test your knowledge of the time complexity of common data structure operations and classic algorithms.

Code35 items

Data Structures: Use & Time Complexity

Test your knowledge of common data structures, their typical uses, and the Big-O time complexity of their core operations.

Code34 items

Common Network Ports and Their Services

Learn which service runs on each well-known TCP/UDP port number.

Code40 items

CSS Properties and What They Control

Learn the most common CSS properties and the styling each one controls.

Code36 items