Chapter 11. The Single-Page Application
The single-page application (SPA), audited. In the book’s terms its architecture is the trivial factorization of Chapter 4 (Prop. 4.2), deployed at industry scale. select and present shrink to near-identities; the application is stuffed into one term that computes all of read. Fetching, state management, templating, and styling decisions interleave in one program, delivered as one bundle.
S1. State is threaded through the term — component state, stores, caches, props — with no factor boundary anywhere; the paradigm’s own architecture diagrams draw the threading as a feature. ✗
S2. The term is imperative, so its meaning is defined by execution order. The failure is in principle rather than in implementation. Def. 4.3 requires each factor to denote a term in a language with closed semantics; an imperative program’s meaning is the trace of its execution. No discipline within the paradigm can repair this, because the paradigm is the choice of trace over denotation. ✗
S3. No factor can be replaced without rewriting the term as a whole. Substitutability needs a factor boundary to swap across, and S1 showed there is none. State, selection, arrangement, and presentation are one program, so changing any concern means editing that program, not substituting a term of a language. ✗
S4. No intermediate value has a URI. The data behind a rendered view cannot be addressed, cached by intermediaries, indexed, or linked. Chapter 3’s exhibit filed the evidence in passing. Stripping style from the dashboard left chrome, the frame with no facts in it, because the curves were pixels on a canvas. The state was invisible even to the application’s own document. ✗
The one-timeline consequence. Independent evolution (Prop. 4.5) states what the fusion costs. One component, one timeline: any change — data, layout, theme, query — is a change to the whole term, and the term is the unit of delivery, so the term is the unit of invalidation. The consequences follow. Each is the forfeit of a property that Fielding’s constraints were chosen to induce:
- caching degrades to bundle-level — the corollary to Prop. 4.5, now an operating cost;
- crawling requires headless browsers — machines simulating humans in order to read what machines produced;
- reuse requires reverse-engineering a private API — the S4 tax, paid by every integrator separately;
- hydration — shipping the document and the program that regenerates it — is the S1 tax: the architecture cannot tell its document from its program, so it ships both.
The R-properties. R1 holds; a program holds any state in memory. R2 and R3 fail together. Component state has no merge law — state-synchronization libraries are the compensating industry. And references are pointers: machine-local by definition.
The platform’s component model. The audit invites one escape: that these are framework failures, and the cure is the platform — which has since shipped its own component model. Web Components are the test case. A custom element gives the fused term a tag name; shadow DOM gives it a boundary the document’s own selectors cannot cross.
Run the scores. The tag denotes nothing until its class executes, so meaning is still the trace (S2). The element’s state lives in the class, threaded as before (S1). The shadow tree is an interior hidden by design: no URI reaches it, and now no selector either (S4). And no factor boundary appeared, so substitution still means rewriting the class (S3). The standard standardizes the seam around the term, not a seam through it: a component boundary is not a factor boundary. Moving the component model from framework to platform moves no score — Chapter 1 filed the framework as an implementation detail, and this is the confirming experiment.
What shadow DOM does standardize has a name the book has not yet used: encapsulation, state hidden behind a boundary on purpose. Chapter 13 files the paradigm that owns the move, and it is not the web’s.
The corollary: the SPA is the un-web — HTTP reduced to a pipe delivering a program whose interior satisfies none of the properties that define the web. The corollary adds nothing to the column: rejecting it means rejecting a score, and each score names the property to take it up with. And a prediction, labeled as one: the paradigm caps structurally at Web 2.0, because Web 3.0 means machine-consumable state (the definition Chapter 20 makes exact), and the paradigm’s defining move is hiding state behind read. Chapter 14 measures the industry’s own retreat from this position; Chapter 22 records what arrived in the meantime.
Column: SPA/JS.
| SPA/JS | |
|---|---|
| R1 | ✓ — any state, in memory |
| R2 | ✗ — no merge; synchronization is bespoke |
| R3 | ✗ — references are machine-local pointers |
| S1 | ✗ — state threaded through one term |
| S2 | ✗ — meaning is execution order, in principle |
| S3 | ✗ — substituting a factor means rewriting the term |
| S4 | ✗ — no intermediate value has a URI |
The column restates the corollary, cell by cell.