jonnify·bcs /bcs/elixir-core/archetypes/one-definition-a-thousand-instruments

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.

The amplification, performed. One definition row, a thousand referencing instruments. Toggle the edit; the readout recomputes the sampled views through the same pure fold — the instrument rows never change, the definition does.
the future archetype multiplier: 50 · one ARC row instrument 1 view: multiplier 50 instrument 500 view: multiplier 50 instrument 1000 view: multiplier 50 … the rest a thousand references, zero copies
readout · Before the edit: the definition carries multiplier: 50; every sampled view reads multiplier 50. Press “edit the definition” to perform A2's move — one write, a thousand answers.
§1

The transcript

bcs_rung_2_4_check.out · verbatim · this dive reads A2
content/echo_data/runtimes/elixir/bcs_rung_2_4_check.out · verbatimfrozen
boot: 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
§2

The economics — 18 words stored, 14 composed

content/bcs2.4.md · What · Decisions

The 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.

Where does the fact live? The Decisions section states the line so reviews can hold it: overrides carry facts; archetypes carry semantics. Select a fact from the chapter's own examples; the readout places it.
readout · Select a fact. The static rule: a number that varies per contract is an override; a behavior that varies per kind is a new bundle.

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).

§3

The lineage — West's turn, Gamma's decade

content/bcs2.4.md · Why

Instrument 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).

§4

The rejected alternative — baked views

content/bcs2.4.md · Decisions · Boundaries

Composition 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.

§5

References

sources · related

Sources

Related