← Course map

GO LEARNING PATH · 11 LESSONS

Patterns: behavior

Eleven classic patterns, from Strategy and Command to State, Visitor and Interpreter.

  1. Strategy: choose an algorithm explicitly

    Pass interchangeable behavior through a function or small interface.

    3 min · Worked lesson

  2. Command: represent an action as a value

    Make actions queueable or reversible without claiming every effect can be undone.

    3 min · Worked lesson

  3. Chain of Responsibility: ordered handlers

    Stop or delegate deliberately and make short-circuit order visible.

    3 min · Worked lesson

  4. Iterator: yield values without exposing storage

    Use iter.Seq or a small Next API and honor early termination.

    3 min · Worked lesson

  5. Mediator: centralize collaboration deliberately

    Let participants communicate through a focused coordinator.

    3 min · Worked lesson

  6. Memento: retain a restorable snapshot

    Let the owner define what a valid snapshot contains.

    3 min · Worked lesson

  7. Observer: subscribe, notify and unsubscribe

    Keep notification lifetime and delivery semantics explicit.

    3 min · Worked lesson

  8. State: behavior follows a valid lifecycle

    Represent legal transitions instead of scattered boolean combinations.

    3 min · Worked lesson

  9. Template Method: fixed workflow, supplied steps

    Adapt the inheritance-based intent using composition in Go.

    3 min · Worked lesson

  10. Visitor: new operations over a stable set of nodes

    Understand the tradeoff between adding node types and adding operations.

    3 min · Worked lesson

  11. Interpreter: evaluate a deliberately small language

    Model a grammar without treating arbitrary text as executable code.

    3 min · Worked lesson