Skip to content

Lesson 06 · Lab

Practice Lab: Design a Compositional Interface

Apply a compositionality checklist to a real system sketch and diagnose non-compositional designs.

~18 min Practice
compositionality-checklistfailure-diagnosisinterface-design-pattern

From theory to a desk check

This lab is a constrained design studio. You will wire a small open system, pick a semantics, and attack your own design with the failure modes from Lesson 1. The interactive compose lab below tracks arity and nesting so the operad discipline stays visible.

Compose lab

Live composition lab

Root operation α has 2 slots. Each child contributes its arity. Composite lives in P(3).

α ∘ (β, γ) ∈ P(3) · arities (2+1)
β

arity P(2)

γ

arity P(1)

Unit check: set any child arity to represent a pass-through only when that child is the unit in P(1) and you intend identity substitution — changing structure without the unit law breaks compositionality.

Compositionality checklist

Ports complete?

Every external dependency appears as a port.

Diagnose before you ship

ModeSymptomRepair
Doc-only hierarchyNesting exists in slides, not in interfacesMake subassemblies real ported boxes
Algebra driftTeams interpret the same wire differentlyPublish α and a golden composition test
Port inflationEverything is public; no encapsulationHide internal wires; minimize outer boundary
Fake compositionalityMarketing claims without preservation lawDemand the equation or demote the claim

When to stop refining an interface

Can a peer predict swap behavior from ports + algebra alone?

Lab protocol (20 minutes)

  1. 01Pick a target: checkout flow, ETL job, multi-agent research crew, or sensor fusion box.
  2. 02Draw outer ports (no more than 6) and three inner boxes.
  3. 03Wire every port; ban hidden side channels (globals, shared mutable caches) unless they appear as ports.
  4. 04Choose algebra X (behavior functions, relations, or cost).
  5. 05Run the checklist; repair any failure mode you can name.
  6. 06Write one sentence: “This design is compositional because …” citing the algebra equation in plain language.

Check yourself

Retrieval practice — feedback explains why.

Q1A compositional interface design must include:
Q2Hidden side channels between boxes usually indicate:
Q3You should stop refining an interface when:

Explain it back

Paste or summarize your lab sketch: outer ports, three inner boxes, wires, chosen algebra, and one failing counterexample you fixed.

Sources · claim ledger