Low-level design

Structural patterns

How objects compose. 7 lessons where the diagrams draw themselves, one class and one message at a time, with the theory and the code beside them.

  • 7 lessons
  • Animated diagrams

Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

7 lessons, each with diagrams that draw themselves.

In this module

  • Add behaviour to an object by WRAPPING it in another object of the same type, stack as many layers as you like, at runtime.
  • Convert the interface a class HAS into the interface a client EXPECTS, a wrapper that translates calls so incompatible code can work together.
  • Give a complex subsystem ONE simple front door, a single class with easy methods that orchestrate all the messy internals for you.
  • Build a tree of part-and-whole objects, then treat a single leaf and a whole branch THE SAME way through one interface.
  • A stand-in that implements the same interface as a real object and CONTROLS access to it, to defer expensive work, check permissions, cache, or reach a remote object.
  • Split one thing that varies in TWO dimensions into two separate hierarchies, joined by a reference, so each can grow independently instead of multiplying.
  • When you need a HUGE number of similar objects, share their common heavy data instead of duplicating it, keep only the per-object differences.

More low-level design

Start Structural patterns

Sign in and the first lesson opens with its diagram ready to play.

DSA comes with the all labs plan and every ChaiCode batch.