Design Patterns reference data

Software design patterns with descriptions and use cases.

  • 8 datasets
  • JSON · YAML · TOON
  • CC0 — public domain

Topic guide

What Design Patterns covers

Design-pattern reference data names the recurring solutions to recurring software-design problems: the creational, structural and behavioral patterns of the 'Gang of Four', the concurrency patterns that coordinate threads, the architectural patterns that shape whole systems, the SOLID principles behind them and the anti-patterns that come from misusing them. Patterns are vocabulary first and templates second: their value is that 'use a strategy here' conveys a design in four words. They also carry costs, since applying a pattern where a simple function would do adds indirection, so each entry states when to use it as well as what it is.

Key ideas

Creational, structural, behavioral
The three Gang of Four groups: patterns for creating objects, for composing them and for assigning responsibilities and communication.
Coupling and cohesion
Coupling is how much modules depend on one another; cohesion is how focused each module is. Good designs reduce the first and increase the second.
Program to an interface
Depend on abstractions rather than concrete classes so implementations can change without affecting callers.
SOLID
Five object-oriented principles: single responsibility, open/closed, Liskov substitution, interface segregation and dependency inversion.
Composition over inheritance
Build behavior by combining objects instead of extending class hierarchies, which keeps designs flexible.
Anti-pattern
A common response to a problem that looks reasonable but causes more trouble than it solves, such as the God Object.
Architecture vs design pattern
Architectural patterns (microservices, MVC) shape a whole system; design patterns (observer, factory) shape a few collaborating classes.

Common pitfalls

  • Applying patterns by reflex. If a plain function or a simple class solves the problem, the pattern adds only complexity.
  • Using Singleton as global state; it hides dependencies and makes testing harder.
  • Treating the pattern's textbook structure as mandatory; adapt it to the language (closures can replace many pattern classes).
  • Naming a pattern incorrectly; a decorator is not a proxy, even though both wrap an object.

Using it from an agent

  • Name the pattern, state the problem it solves, show the minimal structure and note the main trade-off.
  • Recommend the simplest design that works, and name the pattern only when it clarifies communication.
  • Match the example to the user's language and idioms; functional languages often express these patterns with functions.

Start with: SOLID Principles · Creational Design Patterns

Datasets in Design Patterns

Fetch this category

One request returns the category with all of its dataset summaries. Append ?format=yaml or ?format=toon for the other encodings.

GET https://yjtoon.com/api/category/design-patterns?format=json

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets