← Course map

GO LEARNING PATH · 4 LESSONS

Clean code: production contracts

Composition roots, context ownership, package APIs and exact time/money contracts.

  1. A composition root makes lifetime and cleanup visible

    Construct dependencies once and make their ownership and shutdown order explicit.

    3 min · Worked lesson

  2. Context is a cancellation contract, not a bag of dependencies

    Propagate request cancellation while giving detached work an explicit owner and deadline.

    3 min · Worked lesson

  3. Package APIs should reveal their change boundary

    Use narrow consumer contracts and tests that make accidental coupling visible.

    3 min · Worked lesson

  4. Time and money need units and presence in their types

    Separate durations, instants and exact amounts instead of passing ambiguous numbers.

    3 min · Worked lesson