Low-level design

Behavioral patterns

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

  • 10 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.

10 lessons, each with diagrams that draw themselves.

In this module

  • Define a family of interchangeable algorithms, put each in its own class, and let the client swap them at runtime, instead of a big if/else picking behaviour.
  • Define a one-to-many dependency: when one object changes, all its subscribers are notified automatically, without it knowing who they are.
  • Let an object change its behaviour when its internal state changes, so it appears to switch class, by delegating to a State object instead of a wall of if/else.
  • Turn a request into a standalone object, so you can parameterize, queue, log, and UNDO actions, and decouple the thing that triggers an action from the thing that performs it.
  • Pass a request along a chain of handlers; each either handles it or forwards it to the next, so the sender doesn't need to know who will deal with it.
  • Put the fixed skeleton of an algorithm in a base-class method, and let subclasses fill in the specific steps, without changing the overall structure or order.
  • Walk through a collection's elements one by one WITHOUT exposing how the collection stores them, and support multiple independent walks at once.
  • Stop components from referencing each other directly; route all their interaction through ONE mediator, turning a tangled web (N×N) into a clean hub (N).

More low-level design

Start Behavioral 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.