Skip to content

Architecture tests, refactoring seams, decisions, and tradeoffs

Architecture proves its value through outcomes: important rules are cheap to test, integrations fail at known boundaries, composition is visible, and change does not require a rewrite.

Match tests to boundaries

BoundaryEvidenceUseful failure
domain valuedirect examples and boundariesinvalid tag or coordinate is rejected
use casein-memory port plus fixed clock and IDsave failure does not report success
adaptershared contract suitelocal and persistent stores disagree
compositionnarrow integration or launch testproduction graph omits a dependency
critical journeyUI acceptance testcorrect parts are wired incorrectly

Mocking every type would test call choreography instead of product behavior. Prefer real values and small deterministic adapters until an interaction itself is the contract.

Refactor through a seam

To replace direct storage calls, first characterize existing save behavior. Introduce a purpose-named function or port at the caller, move one path behind it, compare outcomes, then remove the old path. A seam permits incremental migration and rollback.

Record the decision

An architecture decision record should state:

  • the product and engineering pressure
  • the chosen boundary and dependency direction
  • alternatives considered
  • costs and known limitations
  • evidence that supports the choice
  • a signal and date for review

The record preserves reasoning, not permanence. When pressure changes, revise the graph in small tested moves.

Measure the right things

Folder symmetry, protocol counts, and pattern purity are weak signals. Watch time to add behavior, test duration, failure containment, build time, onboarding friction, and how often one feature requires unrelated edits.

Series navigation

References