Structural Patterns


How objects get wired into bigger structures without every wire tangling into every other wire. Adapters translate, decorators layer, facades hide, proxies stand in for the real thing. Eight patterns, all about composition, none of them about creation.

  • Adapter Translates one interface’s calls into another’s, so old and new code can talk without either one changing.
  • Bridge Splits two independent hierarchies, like vehicle and workshop, apart so either can grow without multiplying the other’s class count.
  • Composite Lets a tree of leaves and containers, like files and directories, get traversed through one shared interface, no isDirectory checks needed.
  • Decorator Wraps an object in layers of optional, combinable behavior instead of writing a subclass for every combination.
  • Facade Wraps a fixed sequence of subsystem calls behind one method, so callers stop re-implementing the same coordination logic.
  • Flyweight Shares identical state across many objects and passes the unique part in per call, cutting memory that would otherwise scale with object count.
  • Private Class Data Locks a class’s internal state behind getters only, so nothing outside it, not even its own subclasses, can mutate it after construction.
  • Proxy Stands in for a real object, deferring its expensive construction or adding checks, while callers can’t tell which one they’re holding.

← Back to Design Patterns

Want to get blog posts over email?

Enter your email address and get notified when there's a new post!

Comments