CSE Roadmap

Level 4 of 7 · about 2 weeks

Patterns II: structure and behaviour

Strategy, observer, state, command, decorator, adapter, facade, template method, chain, composite and iterator, and how to choose between them.

Modules

Core: everyone needs it. Common: most jobs use it. Specialist: optional depth, safe to skip on a first read.

  1. 1

    Strategy

    Swap one way of doing a job for another without touching the caller

    Core 6 parts · about 3 hours

  2. 2

    Observer

    Tell everyone who cares when something changes

    Core 6 parts · about 3 hours

  3. 3

    State

    Let an object behave differently as its situation changes

    Core 6 parts · about 3 hours

  4. 4

    Command

    Turn a request into an object so it can be queued, logged and undone

    Core 6 parts · about 3 hours

  5. 5

    Decorator

    Add features to one object by wrapping it, not by subclassing

    Core 6 parts · about 3 hours

  6. 6

    Adapter and facade

    Make a mismatched class fit, and hide a busy subsystem behind one door

    Core 6 parts · about 3 hours

  7. 7

    Template method

    Fix the steps of an algorithm once and let subclasses fill in the gaps

    Common 6 parts · about 2 hours

  8. 8

    Chain of responsibility

    Pass a request along a line of handlers until one deals with it

    Common 6 parts · about 2 hours

  9. 9

    Composite and iterator

    Treat a tree and its parts the same way, and walk it without exposing it

    Common 6 parts · about 3 hours

  10. 10

    Choosing a pattern

    Start from the problem, not from the pattern

    Core 7 parts · about 3 hours