How close can a LiveView app come to ideal ALA?

September 29, 2026 · ALA · LiveView · R11 · departures

For most of this project I believed a LiveView page could never be ideal ALA. The framework calls the page with events and URL changes, and a page that routes them has to branch. So the checklist records a few “departures” for LiveView, and the linter scores its rule about the top layer (R11) only at its strictest setting. The linter’s post used to justify that with a sentence saying a page “can’t reach zero.”

That sentence turned out to be wrong, and the linter post has since been corrected. Three variants built this month, V39, V40 and V41, got their pages down to routing and configuration, and when I first scored them the linter found no logic in any of them. Its R11 check has since grown sharper (it now sees for loops, and one abstraction’s result passed straight into another’s call). It finds a little in V39 and V40, all in small page helpers, and still nothing in V41. So this post asks the question again, one departure at a time. For each thing a page does that Spray’s application layer wouldn’t, is it forced by LiveView, forced by Elixir, or just habit?

What Spray asks of the application

Spray’s application layer instantiates abstractions, configures them, and wires them together. It holds all of the app’s specific knowledge and none of its logic: “no normal programming language code such as assignments and if statements” (§3.5), and about 3 to 10% of the code (§2.4). He’s precise about what that excludes. Naming an instance so it can be wired twice is fine (§1.6.6, §3.6.2). So is a small predicate passed in to configure a generic abstraction, like new Filter(x => x>=0) (§3.11.3). What’s out is control flow that decides what runs, and assignments that hold data between calls. He flags his own first thermometer for exactly that: its application “is still doing some logic work - the ‘for loop’ and ‘if statement’, which we will address soon” (§1.6.3).

He also says where each kind of if goes, and I’ll use his list as the yardstick below. Guards move into the connection mechanism (§1.6.4, §6.1.3). Requirement conditions become wired instances, like the coffee maker’s AND gate (§2.9.3). History becomes a state machine (§4.16). A choice of path becomes an abstraction with two output ports (§4.9.1). The order of follow-ups becomes explicit fan-out (§4.4.4).

Spray also describes the application in functional terms: “ALA is, essentially, functional programming. All the top layer code that implements the application itself by wiring up instances of domain abstractions in some combination is pure functional code” (§3.11). The impure work, “execution details, state, and I/O”, lives in “pretested units that are then composed using pure functional code” (§3.11.1). That leaves a choice about where a page’s side effects happen. Spray hides them inside domain abstractions: his Display writes to the screen itself. The usual Elixir answer is the functional core and imperative shell: features return effects as data, and a generic interpreter below the page performs them (V35’s EffectInterpreter, V39’s Binder). Both keep the page pure. The interpreter keeps the features pure too, which is why most of these variants test without Phoenix.

A departure is only valid if none of those moves applies, or if applying one costs more than it buys. That’s the bar.

What LiveView hands the page

A LiveView page is a module the framework calls. It gets:

The page’s state is its socket’s assigns, and they’re immutable: each callback returns a new socket. LiveView tracks changes per assign key, not per field, so it re-renders an expression when the key it reads changed.

Some of this is Spray’s model under another name. Assigns are where the dataflow lands: his temperature connection between a wire and a display (§1.6.6) is an assign the handlers write and the template reads. The template’s nesting is the “display inside” wiring. And one process per page is the single-threaded execution he prefers anyway (§4.4.9). Other parts are genuinely foreign: string-named events, a URL that can change under you, and two mounts.

One consequence of one process per page is easy to miss. Every open page holds its own copy of any shared data, such as stock levels. Spray is wary of exactly this in immutable designs: “one thread could be using and inconsistent or outdated copy of the current actual state” (§3.10.2). The ALA answer is a wiring decision. Pick the instance that is authoritative (a process or the database), treat each page’s copy as a cache of it, and have the page subscribe to its updates. That’s the same PubSub subscription the page already owns. Since 2026-10-21 it is a part the page wires, described in “Changes made elsewhere” below.

One application, or several layers of it?

Several earlier variants treated the LiveView side as an application with sub-layers. V35’s architecture notes stack the page, its manifest, its generated glue, its views, and an effect interpreter as levels under one another, and call the features “application layer” too. V36 puts a shell on top that runs the page’s composition and interprets its outcomes. The linter went along: its layer maps could mark several layers app: true, which kept calls between them from counting as depth. It felt natural. A page, the views it renders, and the code that runs it look like three altitudes.

Spray doesn’t have that. The application is one abstraction, and “there are no subfolders under the application” (§5.4). When an app grows too big for one abstraction, it gets a Features layer under it (§2.2, §7.15). That’s a real layer of product-knowing abstractions with ports, wired by the application, not a subdivision of it. And an execution model, the thing that knows how a kind of connection runs, lives far below, in Programming Paradigms.

Sorted that way, each piece of the old stack lands somewhere definite:

V39, V40 and V41 were built after this correction, and their layout shows it. The page is the application. Feature modules and feature components are the Features layer. Cart, the pricing rules, and generic row components are domain abstractions. The Binder, the circuit and its sinks, and Instance are Programming Paradigms. The Ecto and PubSub wrappers sit at the bottom. There’s no shell, and nothing is marked as a second application layer. (One correction, made later: what these variants call the Features layer holds stateful domain abstractions, not Spray’s features, which are compositions. “When the wiring outgrows a page” below explains it.)

One placement I hold loosely. V41’s feature panels are LiveComponents, and I put them in the Features layer: the page configures and wires each one, and none of them names the page. But their markup is shaped for this page’s layout, and a reviewer could fairly say that part of a panel is application. If that reading wins, the fix is to split each panel into a feature instance that handles events and outputs, and page-owned markup passed in through slots. I haven’t tried it.

So I don’t count application sub-layers as a LiveView departure. They were a naming mistake with two real ideas inside it: features deserve their own layer, and execution machinery should be shared and generic. Spray has a place for both, and it isn’t inside the application.

Pages, components and LiveComponents as abstractions

Spray’s UI abstraction gives each LiveView piece a job. A UI abstraction has a UI-layout port (it can be “put inside an instance of a panel”, Summary), takes the data it shows through dataflow ports, and emits events (§3.5.1). Data sources and sinks are separate abstractions wired to it (§5.2.2). Here is the whole map, as the checklist keeps it (this project’s Elixir reading):

PieceWhat it isWhat it may do
The page’s LiveView module (mount/3, callbacks, render/1)Applicationinstantiate and configure, wire, hold application literals; no computing, deciding, fetching or persisting of its own (R11)
The page’s HEEx templateApplication: the UI-layout wiringcontain UI abstractions in each other (the UI-layout paradigm), wire data into them through attributes and slot values, name the events they emit
handle_event/3, handle_info/2, handle_async/3 clausesApplication: wiresroute an emitted event, a message or an async result to one input, decoding params at the edge; clauses in one module are one place (R8)
The routerApplicationit composes pages
A function component (<.cart_item_row>, <.tabs>, core components)UI domain abstractionrender data passed in as attributes; emit events whose names it’s given; contain children through slots (its UI-layout port); no state, no I/O
A LiveComponent that is a UI widget (a menu, a date picker, an autocomplete)UI domain abstraction with internal statekeep the state of its own interaction (open or closed, the text typed so far); emit events; never fetch, persist or apply the product’s rules
A LiveComponent that holds a feature’s valuea hostfine when it’s generic (a paradigm that runs any feature, renders only what the page passes in through slots, and announces outputs); a bundle when it also renders its own markup and does I/O, which is an R6 finding (V41’s and V41-max’s panels)
A page-specific LiveComponent (the generated FormComponent, V40’s circuit panels)a contained sub-componentnothing: Spray has “no analog of a sub-module or sub-component” (§2.2), so it’s an R11 finding. Use a generic domain UI abstraction the page configures and wires, or move a reusable one down a layer
Feature modules (Features.Cart, Features.Undo)state-and-rules abstractions in a layer the variants call Features (in Spray’s terms stateful domain abstractions, see “When the wiring outgrows a page”){state, outputs} steps with declared ports; no markup, no events by name, no I/O unless I/O is the concept
Store, gateway and placement instances (AddLine, PlaceOrder, Charge, a store module passed as configuration)data source and sink abstractionsdo the I/O they’re configured for; wired by the page into a feature’s inputs or from its outputs
A domain UI component configured with a rule (StockIndicator)UI domain abstractionrender passed-in data using a configured rule instance
A generic shell, effect interpreter, runner or host (EffectInterpreter, Binder, Steps, a generic host LiveComponent)Programming Paradigmsan execution model: it knows how a kind of connection runs, not what this page does (Spray keeps “Execution models.doc” in this layer)
Phoenix.LiveView, Phoenix.ComponentProgramming Paradigms / Foundation, library-providedLiveView’s event → state → render loop is an execution model; a page implementing its callbacks is configuring a more general module (R9)

In short:

The departures, one at a time

Forced by LiveView, and valid

Event routing clauses. The framework calls handle_event("remove_item", params, socket). Something has to match on that string. A multi-clause handle_event with one clause per event is the dispatch, and a clause that only forwards is one wire from an event to an input. That’s Elixir’s pattern matching doing the job of Spray’s port names, not logic. The linter doesn’t count these, and the checklist records the reading as its own Elixir adaptation, not Spray’s words. V41 shows the routing can move into feature components (phx-target={@myself}), but it doesn’t disappear. Some module still matches on the event string.

Decoding params. The browser sends strings. String.to_integer(id) in a clause adapts one format to another, which is a technical domain reached sideways (§7.17). Fine when small. If it repeats everywhere, a generic param caster configured per event would take it out.

Holding the program value. Spray’s instances change in place. Elixir’s don’t, so the page stores each feature’s new state back into assigns after every step. The checklist lists this as a departure, and it’s Elixir’s, not LiveView’s. It’s also not “handling the data” in §1.6.3’s sense as long as the page stores values it never looks inside. V39’s Binder and V41’s panels both do this without the page ever reading a feature’s fields.

HEEx instead of wiring code for the UI. Spray builds his UI tree with WireTo nesting in C#, because WPF gave him nothing better. HEEx is a better notation for the same “display inside” wiring. An earlier comparison of our pages with Spray’s reference app came to the same verdict: moving the UI tree into a wiring table would be reinventing a worse HEEx. This one isn’t a compromise.

Assigns shaped for change tracking. Because LiveView re-renders by assign key, a page does better with @summary and @saved_count as separate assigns than with one struct holding both. That puts named landing points in the page. They’re Spray’s symbolic connections, kept inside one abstraction, and the checklist’s R5 is happy with them as long as no feature needs to know the names.

URL steps belong to the page. handle_params delivers the URL, and LiveView raises if a component calls push_patch inside update/2. So the page owns the table from flow step to path. V41 found this the hard way. Its checkout panel now announces {:checkout, :step, step} and the page patches. That’s a framework constraint that happens to agree with R3, since paths are application literals.

A few lines of client JavaScript. Focusing a field on mount can’t be done from the server. Most of the variants from V28 on ship an AutoFocus hook, attached from the template. It’s residue, it’s small, and it lives in its own file.

Forced by LiveView, but it moves out of the page

if connected?(socket) in mount/3. LiveView mounts twice, and you subscribe to PubSub only on the connected mount. Every LiveView variant carried that one-line guard, and it was the only super-strict finding on most toys. It doesn’t have to be in the page. An on_mount hook is LiveView’s own extension point, so V39 and V41 put the guard in a generic hook in the paradigms layer and configure it on the page:

on_mount {ZeroCoupledWeb.Paradigms.Subscribed, {ZeroCoupled.Foundation.Broadcast, :subscribe}}

The if still exists, once, below the page. That’s Spray’s first move: the guard goes into the connection mechanism. The linter now counts the guard as routing, so the finding is gone either way, but the page reads better without it.

Auth redirects. Same shape, same fix: on_mount is where Phoenix already puts auth. The variants here don’t have auth, so this one is untested.

handle_async results. When a payment job finishes, the page gets {:ok, {:ok, url}}, {:ok, {:error, reason}} or {:exit, reason}. V39 routes the three to Checkout.succeeded/2 and Checkout.failed/2 with three clauses, which is Spray’s two output ports (§4.9.1) written as heads. V40 and V41 move it further: the circuit’s ToAsync sink, or the checkout panel, owns the job and its outcome.

Not forced: habits the variants removed

These are the things I used to count as LiveView’s fault. Every one has a Spray move, and at least one variant made it.

Arithmetic and computed assigns. assign(socket, :total, Enum.sum(...)) is data handling. The zero-coupled variants from V28 on compute totals in a feature and let the page assign the result.

Business rules in handlers. “Can’t check out an empty cart” was an if in the page in the early variants. In V39 it’s Checkout.start/2 returning blocked: :empty, and the page binds blocked to a flash.

History. “Back to address is allowed from payment; forward jumps by URL aren’t” used to be a case in handle_params. V33 turned it into a transitions table, and V39–V41 keep that: the page passes the flow table in as configuration and the feature decides.

Handing values from one feature to another. V35’s contribution was to stop features reading each other’s state and have the page pass values in. V39 still does that in a couple of handlers, like Checkout.pay(&1, %{cart: cart, stock: stock}) and Wishlist.toggle(&1, Cart.find(socket.assigns.cart, id)). The checklist allows it, but by Spray’s §1.6.3 it’s still the page handling data. The linter now reports the second form, where one feature’s result goes straight into another’s call; the first, built into a map, it still can’t see. V40 removes it by making it a wire: the cart announces checkout_requested with its aggregate, and Checkout takes its stock source as configuration.

Loading rows in mount. items = Store.all(...) followed by Cart.new(items: items) is the page moving data between two abstractions. A store source wired into the feature’s :load input (V40), or a component that loads itself (V41), removes it.

Work in page helpers. V39 and V40 keep a few private helpers on the page that the circuit or bindings call: finalize/2 places the order, loops over the lines to decrement stock, and broadcasts each change, and add_line/2 writes a line and then looks it up again. That’s the application doing work, even though no handler branches. V41 moved the same work into its checkout panel, a feature, and a V42 design sketch in the project’s lab notes moves it into a domain abstraction that does its own I/O, as Spray’s Display does.

for loops and compound conditions in the template. A generic list component iterates. A feature computes the boolean. The page’s template only places and configures.

What the variants with posts show

Here is each one’s remaining R11 count at --super-strict, on two linters. The 2026-09-30 linter doesn’t count routing clauses, with, ok/error routing, or the connected? guard, and it does count for loops and one abstraction’s result passed straight into another’s call. The 2026-10-01 linter also reads HEEx templates, so a comparison, a :for, a case or arithmetic in a page’s markup counts too, and it is run with layer maps that place every module (the product pages and paradigms were outside the earlier maps).

VariantR11 findings, 2026-09-302026-10-01 (templates read)What’s left in the top layer
thermometer §1.6.333two nil guards and handled data, the exact things Spray flags in his own §1.6.3
thermometer §1.6.4 onward, including §1.6.6 in LiveView00a runner moves the data; the page holds one program value
coffee maker414its user stories still branch in the composition, the step the thermometer takes at §1.6.4; its template computes too
V3644a plain composition that branches in a few places and hands the cart’s result to checkout
V38882branching handlers, handled data and template logic, kept on purpose (its charter was to evolve a conventional app without adding indirection); built out to the full requirements on 2026-10-01, with 39% of application functions holding logic
V35654URL and sequencing branches from V33’s flows, two hand-offs from the product store into the cart, and logic in its views’ markup
V39435the order-placement loop and line lookup in page helpers, a handler passing the cart’s line to the wishlist, and logic in its views’ markup
V40334the same page helpers as V39, and comparisons and loops in its components’ markup
V41016tab and step comparisons and a tab loop in the pages’ markup; otherwise routing clauses, param decoding, a URL lookup, and with
V42028V40’s circuit without the page helpers; comparisons and loops in its components’ markup
V41-max, V39-max, V38-max, V4500only the forced forms; each also scored 100 on the full hand walk

The pattern is the ladder from the thermometer posts, applied to a real app. Pages that call features one handler at a time keep a few branches and a few handled values. Pages that bind feature outputs once (V39), wire a circuit (V40), or let instances announce what they did (V41) keep no branches in their handlers. V39 and V40 still do some store work in page helpers; V41, which moved that work into its features, was the one at zero until the linter read templates. Once it does, only the max variants and V45 are at zero, because only they moved the comparisons and loops out of their markup too.

How far a page actually gets

Here is V41’s cart page, minus attributes and the template. It’s typical of the three.

def handle_event("switch_tab", %{"tab" => tab}, socket),
  do: {:noreply, assign(socket, active_tab: String.to_existing_atom(tab))}

def handle_info({:cart, :removed, item}, socket),
  do: {:noreply, pass(socket, Undo.Banner, "undo", capture: item)}

def handle_info({:undo, :restored, item}, socket),
  do: {:noreply, socket |> pass(Cart.Panel, "cart", receive: item) |> put_flash(:info, "Item restored")}

def handle_info({:checkout, :step, step}, socket), do: {:noreply, patch(socket, @step_paths, step)}

Every line is an instance, a wire, a literal, or configuration. That’s Spray’s test (§3.5.2). Reading the clauses tells you what the store does.

What’s left, looked at honestly:

What getting there costs

The three designs reach the same place by different routes, and none is free.

The linter scores all three within a point of each other (97 under --strict on the 2026-09-30 linter; 94 or 95 on the 2026-10-01 one). What separates them is what it can’t see: readability, hops, and how much vocabulary a new developer has to learn.

Past zero findings: pages at 100

Zero R11 findings says the top layer holds no logic. It doesn’t say the whole program follows ALA. For that I walk every rule of the checklist by hand, R1 to R11 with their “must” and “should” parts, and deduct for each finding: a local “must” costs 1, a structural one 2, a “should” or a judgement case half a point to 1, and a cost beyond the recorded LiveView departures 1 or a half. On that walk the best of the variants above scored 92 (V41) as first published, 88 after the rescores described below. So I took three of them, in copies, and changed each until the walk found nothing left to deduct.

VariantBeforeAfterHow it got thereFamiliarity
V41-max88100 (98 until its panels lost their I/O)V41’s feature components, with every word supplied by the page, configuration built once, outputs as facts, and one route table per page instead of a handle_info clause per wire4 of 5
V39-max82100V39’s bindings map, with store work and the payment call moved out of page helpers into configured domain instances behind a small paradigm protocol, no handler building another feature’s input, mount as an event on the map, and a test that every port is bound or deliberately ignored3 of 5
V38-max85100V38’s plain LiveViews, built out to the full requirements, with their logic moved into features and configured domain rules, and its wiring written as wire/3 function clauses, one per output port, checked by a test that reads the clause heads4 of 5
V4699 (V45, 2026-10-02 readings)100V45 with Spray’s Features layer: user stories that wire their own parts and lay out their own views, a page that wires the stories, a generic record form instead of FormComponent, and the coded modules named State3 of 5
V4799 (V39-max, 2026-10-02 readings)100V39-max with the same stories, each wired by its own bindings map, every port typed and the whole composition checked at mount and drawn from the value that runs3 of 5
V4899 (V45, 2026-10-02 readings)100V45 with only a generic record form and the coded modules named State; no Features layer, since its pages are under Spray’s size limit4 of 5
V4997 (V41-max, 2026-10-02 readings)100 (99.5, the hop)V41-max without its route table: plain handle_info clauses, store work through LiveView tasks, panels named by the page5 of 5

Every one of them needed the same moves the table of departures above describes, applied all the way: no arithmetic, rule or loaded data in the page, no words or codes below it, no page helper doing store work, and no comparison in the template (generic components such as pane, tabs and none take those). What differs is how the wiring is held: a route table between components, a data map run by a binder, or plain clauses. None of the three is a copy of another.

Rescored 2026-10-02. Two of Spray’s statements are now read strictly, and they take each of these off 100. A page-specific LiveComponent is a contained sub-component, since Spray has “no analog of a sub-module or sub-component” (§2.2). All four still have the FormComponent that phx.gen.live generated for the product pages (R11, −1). And Spray’s features are compositions (§2.2), while the modules these variants call Features are coded state and rules (R8 “should”, −0.5; “When the wiring outgrows a page” below explains it). V39-max, V38-max and V45 are now 99 (98.5), and V41-max is 98. The table keeps the scores as they were reached.

What holds the 100 up

A 100 means no finding on this checklist and scale. It doesn’t mean the design is best. A few judgement calls hold it up, made the same way in each:

What the measurement can’t tell you

Walking three designs to 100 also showed where the measurement itself is weak.

What reaching it costs

The limits on reaching it are the costs of the three designs, and none is free:

So a LiveView app can reach a full score on this checklist, in more than one way (V41-max, V39-max, V38-max and V45), keeping only the forced forms listed below. What the score can’t carry is the judgement behind it, and what it can’t price is the design each team has to adopt to get there.

Which to adopt

Six variants score 100 on the full walk and meet all ten rules the linter checks: V46, V47, V48, V49, V50 and V51. Judged on ALA purity first and familiarity second, V50 is my default. It has no relays between components, it’s familiarity 5, and a team learns only a two-function runner and one wire/3 clause per port. The other five are for particular needs, listed at the end of this section. Pick V51 for pages at or past Spray’s size limit, V48 if a misnamed instance should fail loudly, V49 if your team builds pages from LiveComponents, V46 if stories should each be held under their own key, and V47 if the wiring should be a typed value checked at mount.

The score can’t tell those six apart, so the choice comes down to familiarity, page size, and whether your team uses LiveComponents. The rest of this section shows where the trade-offs come from. V50 and V48 descend from V45, which wires each feature with wire/3 clauses in the page. V49 descends from V41-max, which wraps each feature in a LiveComponent. Before the stricter readings of 2026-10-02 and 2026-10-03, those two were my recommendation, with V45 the default, and comparing them shows what each way of wiring costs.

Two other variants that reached 100 under the earlier readings dropped out for plain reasons. V39-max is familiarity 3, and its binder’s vocabulary of binding kinds buys nothing on the score that the others lack. V38-max is V45 without V45’s safety. Both wire with wire/3 clauses, but V45 adds named instances that fail loudly when one isn’t configured, and a check that can fail the build on an unwired port. Nothing in V38-max scores higher, so there’s no reason to choose it over V45.

That left two designs, both familiarity 4, that hold each feature’s state the same way and wire it differently.

How alike they are

With the app’s module name normalized (GoodDeal, ZeroCoupled), about 70% of the non-blank lines in each codebase are the same. By part:

PartLines shared
Feature state modules (cart, checkout, undo, saved items, wishlist, portal)636 of V45’s 671
Domain rules and configured instances176 of V45’s 210
UI components (rows, panes, badges)406 of V41-max’s 407
Store, schemas, gateways and Phoenix scaffoldingnearly all

Every difference is in how the pages hold and wire the features:

Switching between them means rewriting the pages and adding or removing the panels. The features, rules, components and store stay as they are.

How the wiring differs

Both designs wire the same ports. Here is one connection in each. When a wishlisted product goes to the cart, the store adds the line and the cart receives the stored line.

V45, a clause in the page:

defp wire(s, :wishlist, {:taken, product}),
  do:
    s
    |> Steps.feed(:cart, &Cart.receive/2, {:add_line, &AddLine.run/2}, product, &wire/3)
    |> put_flash(:info, "Added to cart")

V41-max, an entry in the page’s route table:

{:wishlist, :taken} => [
  feed: {:add_line, &AddLine.run/2, {Cart.Panel, "cart", :receive}},
  flash: {:info, "Added to cart"}
],

They read about the same. The differences sit underneath.

Choosing

On purity, V45 was the recommendation over V41-max. It keeps all the wiring in one place, takes no hop, has nothing mounted only to receive messages, and checks coverage when it compiles. It’s also the smaller design to learn, since a wire is a function clause.

Choose V41-max when one of these matters more:

If it’s still unclear, build one real page both ways and keep the one your reviewers read faster. With about 70% of the code shared, that experiment is cheap.

Updated 2026-10-02: four variants at the top, and which to choose

The stricter readings of that day took V45 to 99 and V41-max to 98 (97 once a later walk found its panels naming themselves). Four new variants each score 100, meet all ten rules the linter checks, and keep the familiarity question in view:

WiringHopsFamiliarity
V48V45’s wire/3 clauses, with only the two fixes (a generic record form, State for the coded modules)04
V49LiveComponent panels and plain handle_info clauses; store work through LiveView tasks; the page names each panel15
V46V45’s clauses split into Spray’s features: user stories wired by the page03
V47the same stories, wired by typed bindings maps checked at mount and drawn03

So the strict rules don’t force a familiar team to give up a full score.

Rescored 2026-10-03. R10 is now read strictly too, against Spray’s §6.17.2, and it costs every variant. Checkout received the whole cart (%Cart{}), which the checklist already named as missing R10 and every walk had passed (−1). And the storefront’s cart, carrying promo, gift-wrap and shipping state, is the struct the portal’s order lines are built on: one use case’s data in a struct another shares (−1). V46 to V49 then took both fixes. Checkout gets only {cart_id, items}, and the portal’s order lines have their own struct on a new Lines abstraction, a plain list of stored lines that both use cases share without sharing each other’s data. All four are back at 100 and meet all ten rules the linter checks. V45 and the max variants, which didn’t take the fixes, are at 95 to 97. The order of the recommendation below doesn’t change.

The recommendation now:

When the wiring outgrows a page

All of the designs above put a page’s whole composition in one place. In a very large app that place gets unwieldy, and the obvious fix is to split it into several files in one directory, or give each part of the app its own top-level directory. The second instinct is right. The first is weaker than it looks.

Spray’s answer to a large application is a layer, not a file split. “If a single abstraction is used for the application, then as more and more user stories are added into it, it will eventually get too large for the ALA size constraint… it is the application that will go over the 500 line complexity limit. ALA will need to be applied to the large application abstraction by adding a new layer below it” (§2.2). That layer is Features, or user stories. The application then “just composes a set of features or user stories needed in that specific application, and sets up any communication that may be needed between them” (§2.2), and features are “the natural abstractions in the requirements” (§7.15).

So you split along concepts. A part you split off has to be something you could name and read on its own. Cutting one page’s wiring across files with no concept for each file leaves one abstraction in several files. The size limit still applies to the whole, and a link from one file to the next is a symbolic connection: “as a program grows, these symbolic wirings are always hard to follow. You would need to resort to text searches” (§1.6.3).

A graph makes this harder, as you’d expect, but Spray reads the difficulty as a signal. User stories are cohesive, so a cut along them keeps most wires inside a feature. When a cut can’t, one of two things is wrong. Either the features are drawn in the wrong place, or a thing many of them connect to belongs a layer down. That second case is his “ground symbol” smell (§3.6.1): when many ports connect to one thing, that thing should be an abstraction, not a wire.

LiveView already partitions for you, at the route. The router composes pages, and pages reach each other only through URLs, PubSub and the store. So the router acts as the application, each page is a feature-sized application of its own, and what has to scale is one page’s wiring. A PubSub topic between pages is a symbolic connection too (§4.7.4), which is why the variants keep its subscribe and publish behind one module (Broadcast, and since 2026-10-21 ChangeFeed, below).

Do the variants do this yet?

They didn’t, until V46 and V47. Going back to Spray’s text for this section showed me that our “features” aren’t his. A Spray feature holds wiring, the same as the application: “Each feature creates instances of domain abstractions, configures the instances with feature specific details, and connects them together as needed to express the feature or user story” (§2.2). Its UI goes with it. The layout and “the bindings of the UI elements to data” are “kept together, encapsulated inside a feature. Instead, the UI is composed from Domain UI abstractions” (§7.14).

The modules our variants call features (Undo, Cart, Wishlist, Checkout) are coded state with ports. Each is a {state, outputs} step with logic inside. In Spray’s terms they’re stateful domain abstractions. Undo would serve any app in the storefront domain, and Cart is a storefront’s cart. Every edge stays the same under the right name, but the wrong one misleads a reader who knows Spray’s vocabulary, and since 2026-10-02 the checklist scores it as an R8 “should” (−0.5). It also meant no variant had Spray’s Features layer. Each page was the whole composition for its route.

At this size that’s still fine, but only just. V45’s cart page is 484 lines with its template, right at the limit where Spray adds the layer. Its portal page is 308. So I measured how the cart page would split. Of its 29 wire/3 clauses, 9 connect one feature to another, and every one of those touches the cart: removed goes to undo, and restored, moved and taken come back to the cart. The other 20 wire a feature to the page’s own landing points (assigns, streams, flashes, timers and store instances). Cut by user story (edit the cart, undo a removal, save for later, the wishlist, checkout), the page would wire 9 links between stories and leave the rest inside them. The portal is similar: 5 of 15, each touching the order. That’s a good cut. The crossing links are few, and they meet at the thing the stories are all about.

A Spray-shaped split needs three things, and V46 and V47 built each of them:

The measured cut held, with one surprise. The cart page wires 12 links between its five stories, not 9. The other three were there in V45, but hidden in shared page assigns and in an event the checkout’s view sent straight to the cart. A story owns its view, so each became a wire the page can be read for.

This also changes how I think about ALA itself. Spray’s definition is three constraints, but his designs use many paradigms and specialized, typed ports, and he treats that as ordinary: “we will for the first time use multiple programming paradigms, a usual thing in real ALA projects” (§7.14). A story layer, a nesting runner and a wiring form that composes are the same kind of invention. The tension is cost. Each paradigm is something a team has to learn, which is the familiarity price these variants keep paying, and why the recommendation above favours the smallest vocabulary that still scores 100.

Does partial ALA pay?

If a page can only reach zero by adopting one of those designs, is a page that stops short worth anything? Spray’s own history says yes. ALA didn’t start as a design he applied to whole programs. “The turning point was when I noticed two (accidental) successes in parts of two projects” (§1.5.1). Those parts had “undergone considerable maintenance” for 15 years in one case and 5 in the other, “but their simplicity had never degraded.” He compares it to finding “two pieces of metal that had never rusted” at a rubbish dump. The projects around them weren’t ALA. The parts that happened to be built that way kept their value anyway. His state-machine story is the same: one A3 diagram replaced 5000 lines of C in a real device, and it “was easy to maintain for years to come” (§4.16), inside a program that wasn’t otherwise ALA. And his advice for legacy code is to convert it one user story at a time: “Conversion of user stories takes place iteratively” (§8.3).

So benefits come in proportion to compliance, mostly. The reason is that most of ALA’s benefits are local to an abstraction’s boundary. An abstraction whose own dependencies all drop to more abstract things can be read and changed without reading anything else. That’s true whatever its neighbours do, which is why Spray’s two parts stayed clean for years inside messy projects. The same goes for a literal hoisted to the page, a feature that stops reading a sibling’s state, or a guard moved into a runner. Each one pays on its own, and V38 got real value from exactly that kind of step-by-step change.

Some benefits need critical mass, though, and a partial page doesn’t get them:

That’s the view I’ve settled on for LiveView. A page with a few forwarding clauses and a URL lookup loses nothing, because those forms aren’t logic. A page that keeps some real logic still gets the local benefits of every abstraction below it, and it’s a legitimate stopping point. What it gives up are the whole-page properties above. That’s a trade you can name, and it doesn’t mean the effort was wasted.

So how close?

Closer than I thought, and the gap is small and specific. A LiveView page can be ideal ALA except for:

  1. routing by event name and URL, which Elixir does with pattern matching instead of port names;
  2. decoding browser params, a technical-domain adapter at the edge;
  3. storing the program value back, because Elixir is immutable;
  4. a lookup table from URL to step, because the framework hands the page the URL;
  5. a JavaScript hook or two for things only the client can do.

None of these is logic. Each has a reason in the framework or the language, and none has a Spray move that removes it without replacing it with something equivalent. Everything else I used to excuse as LiveView’s nature (guards, rules, arithmetic, handled data, history, loops, even connected?) has a Spray move, and a variant here that made it. Six variants, V46 to V51, now make all of them at once. They score 100 on the full walk, within the limits of that measurement described above, with Spray’s statements on sub-components, features and shared data read strictly, and they meet all ten rules the linter checks.

The ALA Checklist now carries this whole account, the departures, the variant table, and the costs, in a section of its own (“How close a LiveView page can get”), so a reviewer can apply it without this post.

The other honest finding is about cost, and it has come down. Getting to 100 still means choosing a design that a team has to learn and keep, whether that’s a binding map, a route table, story modules or clauses as wires. But the smallest of them, V50’s two-function runner and one clause per port, is familiarity 5, so a full score no longer has to cost a team its familiar LiveView. R11 stays in the linter’s strictest tier all the same. It’s not that a page can’t reach it. It’s that reaching it is a design decision, and a CI gate shouldn’t make that decision for a team that hasn’t.

Changes made elsewhere

Added 2026-10-21. One process per page means every open page holds its own copy of shared data, and the page has to subscribe to keep it current (see “What LiveView hands the page” above). Until this month every variant built that subscription by hand. A page subscribed to Broadcast’s topic in mount/3 or through the Subscribed hook, wrote a handle_info clause per kind of message, built the stories’ %{product_id, stock} change itself, and wrote more clauses to ignore the messages it didn’t want. A new kind of outside change meant a clause on every page that cared, and the pages missed what nobody had written a clause for. In all three of V50, V51 and V51B, a staff stock edit at /products never reached an open cart or portal: the product pages broadcast product_updated, and the cart and portal ignored it.

A change-cost experiment run the same day, ten requirement changes made in sequence to a conventional Phoenix app and to V51B, put a number on it. The steps that added live updates were among ALA’s most expensive and held most of its confirmed defects. The conventional app got its live updates almost free from broadcasts its context already made on every write (Catalog.broadcast(product, :product_updated)), with each page handling them. The checklist counts that conventional form as the coupling ALA forbids, because the model, not the composition, decides what reaches every view (R1, R10).

So outside change is now a paradigm, built once and wired like any other part. The checklist calls it a live subscription port. In the variants it is GoodDealWeb.Paradigms.ChangeFeed, and V51B’s portal shows both ends:

# subscribe: a part the page mounts and wires, like a story
|> ChangeFeed.mount([topic: Catalog.changes_topic(), facts: [:stock]], out(:feed))

defp wire(s, :feed, {:stock, change}),
  do: s |> to(:edit_lines, :stock, change) |> to(:catalog, :stock, change)

# publish: the composition that makes a change hands it to the same paradigm
ChangeFeed.publish([topic: Catalog.changes_topic(), facts: [:product, :stock]], product)

What makes it ALA rather than a tidier Broadcast:

The page writes no handle_info clause for it. ChangeFeed.mount/3 subscribes once connected and attaches one handle_info hook (attach_hook/4) that sends each fact out of the feed’s port through the page’s own out. That is also why it can’t be an on_mount hook like the Subscribed hook above: the page’s out closes over its private wiring, which on_mount can’t reach. The connected? guard moves into the paradigm, the same move as before.

Isn’t this just LiveView?

No, and the name avoids “Live” because the question is a fair one. They solve different halves.

LiveView keeps a stateful process for each open page and, when that process’s state changes, renders the template and pushes the diff to its browser over a websocket. It solves page to browser. It has nothing to say about how the process’s state changes when the cause is somewhere else, such as another shopper’s purchase in another process or a staff edit at /products. A plain LiveView app answers that with Phoenix.PubSub and hand-written handle_info clauses, which is what the variants did until now.

ChangeFeed solves world to page. It takes a change made anywhere, carries it as identity-keyed facts over Phoenix.PubSub, and delivers each fact into the parts inside the page’s process through the page’s own wiring (feed.stock → edit_lines.stock), the way any other output reaches a part. Then LiveView does what it always does: the part’s new state re-renders and the diff goes to the browser.

So ChangeFeed sits upstream of LiveView and uses Phoenix.PubSub for transport. It replaces neither. What it replaces is the per-page handle_info clause for each kind of change, and the conventional alternative of a context broadcasting what pages should show. The Rails variants have the same paradigm under the same name, where the transport is Action Cable and the page is rebuilt per request (the Rails post compares it with Turbo’s broadcasts_to).

Moving onto it closed the staff-stock gap in V50, V51 and V51B, with one publish setting in each. It didn’t make everything live. In V51 and V51B a price, name or new product still doesn’t reach an open cart or portal, because no state part has an input that takes them. The feed makes such a change one wire once that input exists, but it doesn’t create the input.

What it costs at run time

The checklist now carries a run-time note under “Kinds of connection”, and V51 is the design I measured it against. ALA changes no complexity class: a wire is one indirection, and Spray’s only structural claim is that performance is decided at wiring time (push or pull, sync or async, batching, §3.4.5, §4.3), so changing it never touches a feature. What the design makes visible is where each cost sits:

None of this is a reason to choose or avoid the design; it’s a reason the design is cheap to reason about. The reviewer’s test the checklist gives is the one I did: trace each input to its sinks, find each pull port’s callers, and ask each two-input instance whether it emits on input or on change.

What hasn’t been tried yet

Before V51, five variants had reached 100, but each took its techniques as a set. Several techniques that work in one variant have never been combined with another’s. These are the combinations that looked able to keep a full score while raising familiarity, adding a property a team would want, or meeting the checklist under the linter’s strictest tier. The first and third are now built, as V51. The other three are still unbuilt and unmeasured, and their familiarity figures are my estimates. A sixth, at the end of the list, is about the linter rather than a variant.

Two techniques from the field guide’s later steps stay off this list. A graph value with a runner has been built, as V40 and V42’s circuits, and it cost two hops and familiarity 2 there. One process per instance is the most literal reading of Spray’s objects, but Elixir’s own guidance lists organizing code by process as an anti-pattern, so it only fits where the concept really is concurrent.

The first and third looked strongest together, and V51 bore that out. The Features layer and the linter’s strictest tier both came at familiarity 4. Of the three left, build-time checks look like the cheapest next step, and V51’s stories would give them more to check, since each story has its own ports, inputs and events.

← all posts