B2.4 · dive 2 — one definition, a thousand instruments
One edit, a thousand answers.
A2 is the feature the whole shape exists for: a thousand instruments reference the future archetype, one edit raises its multiplier, and every sampled instrument answers multiplier 100 at next read — no migration, no fan-out write.
Source: content/bcs2.4.md, quoting bcs_rung_2_4_check.out; the resolver
at runtimes/elixir/lib/echo_data/bcs/archetypes.ex composes the view at read time, which is
what makes the amplification possible.
multiplier: 50; every sampled view reads
multiplier 50. Press “edit the definition” to perform A2's move — one write,
a thousand answers.The transcript
bcs_rung_2_4_check.out · verbatim · this dive reads A2boot: the registry grows by one -- ARC, archetype definitions as rows A1 order ok -- composition order proven: tick 0.25 from the instrument, settlement :daily_mark from the archetype, margin true from the base A2 amplify ok -- one definition edited, a thousand instruments follow: multiplier 100 at next read; an instrument row is 18 words, its composed view 14 A3 guard ok -- the diamond is unrepresentable (one :extends) and the cycle is refused: {:error, :cycle}; depth capped at 8: {:error, :depth} A4 rows ok -- archetypes are rows: an AST name refused with {:error, :namespace}; ARC pages newest-first like any property A5 cost ok -- read-time composition over a depth-2 chain: store-lane 5442 ns/op vs snapshot-lane 1048 ns/op; a bare row get is 2653 ns/op PASS 5/5
The economics — 18 words stored, 14 composed
content/bcs2.4.md · What · DecisionsThe economics ride along: an instrument row is 18 words, its composed view
14 — the row stores a reference and deltas, and the view is computed, which is the part
preface's snapshot is a structure guideline wearing its taxonomy clothes. The trading desk's
“all index futures now mark daily” is an edit to one entity, not a redeploy of a class; the
desk's configuration changes become auditable entity history instead of deploy events.
Static placements — tick → an override (per contract) · lot → an override (per contract) · expiry → an override (per contract) · daily marking → a new bundle (semantics — daily marking is not a big tick).
The lineage — West's turn, Gamma's decade
content/bcs2.4.md · WhyInstrument taxonomies are where class hierarchies go to grow teeth: equity, future, option, each sharing margin and settlement machinery, each diverging somewhere — and twenty years of inherited game-engine wisdom says the subclass tree ends in tears. West's component turn was the industry-scale retreat from exactly this shape. The Gang of Four had stated the principle a decade earlier: favor composition over class inheritance, a judgment Gamma stood by — “I still think it's true even after ten years” — because the base-subclass coupling is implicit and brittle.
BCS gives the principle its data-only form: the shared semantics are a row, the kind is a reference, and the specialization is a map. The row discipline comes from Property Stores on ETS (B2.2); the snapshot the lanes resolve against comes from The CHAMP Property Database (B2.3).
The rejected alternative — baked views
content/bcs2.4.md · Decisions · BoundariesComposition happens at read time. Baking views in at write time was considered and rejected: A2's amplification is the product feature, and a baked view is denormalized drift with a delay fuse. The Boundaries section holds the same line from the other side: resolution is uncached by design at this rung — the epoch-snapshot lane is the cache strategy, and per-read memoization inside the resolver would hide the boundary cost A5 exists to show. The lanes and their measured costs are dive 3's subject.
References
sources · relatedSources
- West — Evolve Your Hierarchythe component turn; the industry-scale retreat from the subclass tree
- Venners — Design Principles from Design PatternsGamma on composition over inheritance, defended a decade on
Related
- B2.4 — Archetypes and Compositionthe module hub; the full rung in context
- B2 — The Elixir BCS Corethe chapter landing; the Part II arc
- B2.2 — Property Stores on ETSthe store family the :archetypes store belongs to
- B1 — Ideas Behindthe law and the identity contract
- Functional Programming in Elixirthe umbrella where echo_data lives