Architecture Rules
MVT architecture rules have moved to the Architecture section. This page provides quick-reference tables linking each rule to its documentation.
See: Architecture Rules (full) - Style Guide - Glossary
Universal MVT Rules
These apply to any MVT implementation regardless of language or renderer. The canonical definitions live in Architecture Rules.
Model Rules
| Rule | Constraint | Reference |
|---|---|---|
| M-time | All state advances through update(deltaMs) only | Architecture Rules |
| M-isolation | Models must not reference views or the ticker | Architecture Rules |
| M-domain | State uses domain-level terms, not presentation terms | Architecture Rules |
| M-composition | Parent models delegate update(deltaMs) to children | Architecture Rules |
View Rules
| Rule | Constraint | Reference |
|---|---|---|
| V-stateless | Views hold no domain state | Architecture Rules |
| V-refresh | refresh() runs once per frame, after all models have updated | Architecture Rules |
| V-idempotent | refresh() must be idempotent | Architecture Rules |
| V-readonly | refresh() must not mutate models | Architecture Rules |
| V-reactive | Query bindings given as functions must be re-read in refresh(), never cached | Architecture Rules |
| V-presentation | Views may hold cosmetic presentation state the model does not track | Architecture Rules |
| V-output | Views can target any output technology | Architecture Rules |
| V-tree | View trees do not need to mirror model trees | Architecture Rules |
Ticker Rules
| Rule | Constraint | Reference |
|---|---|---|
| T-sequence | Each frame follows strict order: update, advance view state, refresh, render | Architecture Rules |
| T-cap | Cap deltaMs to a safe maximum | Architecture Rules |
| T-minimal | The ticker contains no domain logic and no rendering code | Architecture Rules |
| T-control | The ticker may pause, slow, speed up, or single-step time | Architecture Rules |
Binding Rules
| Rule | Constraint | Reference |
|---|---|---|
| B-contract | Bindings are the contract between a view and the world | Architecture Rules |
| B-reusable | Reusable leaf views use a bindings interface; top-level views may access models directly | Architecture Rules |
| B-optional | Relay bindings should usually be optional | Architecture Rules |
| B-wiring | Bindings are wired at the view construction site | Architecture Rules |
Hot-Path Rules
| Rule | Constraint | Reference |
|---|---|---|
| H-cost | Minimise per-tick computation cost | Architecture Rules |
| H-alloc | Avoid per-tick heap allocations in update() and refresh() | Architecture Rules |
| H-loops | Use index-based loops and pre-allocated structures | Architecture Rules |
| H-change | Use change detection for rare but expensive updates | Architecture Rules |
Repo-Specific Conventions
These are style and structural choices for this project, not MVT requirements. See the Style Guide for full details.
| Convention | Reference |
|---|---|
| Factory functions, not classes | Style Guide |
String-literal unions, not enum | Style Guide |
Kind not Type, phase not state | Style Guide |
| Barrel imports only | Project Structure |
| 4-space indentation | Style Guide |