api: YAML JSON TOON Database
version: 1.0.0
format: yaml
dataset:
  id: 2908
  slug: structural-patterns
  title: Structural Design Patterns
  description: "Structural design patterns: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy with intents and when-to-use guidance."
  summary: "Structural design patterns that compose classes and objects into larger structures: Adapter, Bridge, Composite, Decorator, Facade, Flyweight and Proxy, each with intent and when to use it."
  use_when:
    - You need to wrap, combine or simplify existing components.
    - You are comparing Adapter, Decorator, Proxy and Facade.
  caveats:
    - Adapter, Decorator and Proxy all wrap an object; they differ in intent (convert, extend, control access).
    - Each layer of wrapping adds indirection and can make debugging harder.
  related:
    - creational-patterns
    - behavioral-design-patterns
    - solid-principles
    - architectural-design-patterns
  entry_count: 7
  fields:
    - section: patterns
      field: name
      type: string
      example: Adapter
    - section: patterns
      field: intent
      type: string
      example: Convert interface of one class to another expec…
    - section: patterns
      field: when_to_use
      type: string
      example: Integrating incompatible interfaces, legacy cod…
  category: Design Patterns
  category_slug: design-patterns
  tags: design patterns,oop,software engineering,structure
  view_count: 53
  created_at: 1777673262
  updated_at: 1777673262
data:
  patterns:
    - name: Adapter
      intent: Convert interface of one class to another expected by clients
      when_to_use: Integrating incompatible interfaces, legacy code wrapper
    - name: Bridge
      intent: Decouple abstraction from implementation so they vary independently
      when_to_use: When both abstraction and implementation need extensibility
    - name: Composite
      intent: Compose objects into tree structures to represent part-whole hierarchies
      when_to_use: Tree structures, recursive composition, uniform treatment
    - name: Decorator
      intent: Attach additional responsibilities to an object dynamically
      when_to_use: Adding behavior without subclassing, open/closed principle
    - name: Facade
      intent: Provide a unified interface to a set of interfaces in a subsystem
      when_to_use: Simplifying complex subsystems, entry point abstraction
    - name: Flyweight
      intent: Share objects to support large numbers of fine-grained objects efficiently
      when_to_use: Memory optimization, many similar objects
    - name: Proxy
      intent: Provide a surrogate or placeholder for another object to control access
      when_to_use: Lazy loading, access control, logging, remote objects
