A2.06 · The value ladder · dive 2
Dependency order
Composing kept the rungs that are capabilities. The order between them follows one rule: each rung may depend only on the rungs below it.
A ladder that obeys the rule is a topological order of the dependency graph, and value accrues bottom-up — the lowest rungs are the foundation the rest stands on. Two sorts are in play: by dependency (the hard constraint) and by value (the soft preference). Read the order on the right top-down, or as the dependency graph, and watch every dependency arrow point downward.
Every dependency points down · switch the view
Each rung depends only on rungs below it
With the capabilities chosen (dive 1), the order between them is not free. One rule fixes it: each rung may depend only on the rungs below it. Stated precisely, a ladder r₁ … rₙ is in dependency order when, for every rung rᵢ, every rung it depends on already appears below it — deps(rᵢ) ⊆ {r₁, …, rᵢ₋₁}. That is exactly a topological order of the dependency graph.
The consequence is that value accrues bottom-up. Rung 1 is usable on its own; rung 2 adds to it; each higher rung extends what is already there. So the lowest-numbered rungs are the foundation, and a single edge that points upward — a rung that depends on something not yet below it — breaks the order. The ladder stops being a ladder the moment one dependency points the wrong way.
- dependency order
- For every rung, every rung it depends on appears below it: deps(rᵢ) ⊆ {r₁, …, rᵢ₋₁}. A topological order of the dependency graph.
- topological order
- A linearisation of a directed acyclic graph in which every edge points from a later node to an earlier one — here, every dependency points down.
- accrues bottom-up
- Rung 1 is usable alone; each higher rung adds to what is below. The lowest rungs are the foundation value rests on.
- violation
- An edge that points upward: a rung that depends on a rung not yet below it. One is enough to break the order.
Dive 1 fixed which stories are rungs; this dive fixes their order; the next (A2.06.3) shows what the order buys — every prefix runs.
Ordering by value, ordering by dependency
Two sorts pull on the ladder, and they are not the same. By dependency is the hard constraint: a rung cannot precede something it needs, or it cannot be built. By value is the soft preference: ship the most valuable usable rung first. They reconcile by precedence — dependency wins where they conflict, and value chooses the order only among rungs that do not depend on each other. A topological sort that breaks ties by value gives both.
Reorder the four rungs below to test an order. A permutation that keeps every dependency below its rung is a valid ladder; one that lifts a rung above a rung it depends on is a violation — the checker names the first offending rung and paints it burgundy. The landing read a fixed ladder bottom to top; here the order can be broken on purpose, so the violation surfaces. That is the difference between reading a ladder and checking one.
Reorder the rungs · expose a dependency violation
Dependency is the hard constraint and value the soft preference: dependency wins where they conflict, and one upward edge is enough to break the order.
Dependency order on the Portal
On the Portal — the learning platform this course builds — the dependency graph is a chain:
browse ← enrol ← open lesson ← track progress, each arrow reading
“depends on”. Because the graph is a chain, the topological order is total: the only order that
builds is browse, enrol, open a lesson, track progress. Swap any adjacent pair and a
dependency points upward. Put enrol before browse, and enrol depends on a rung not yet below it — the
order is no longer a ladder.
Dependency order is a predicate over a candidate order. The predicate walks the order and, for each rung, confirms every dependency already appears strictly below it.
# The Portal dependency graph — a chain. Each rung lists what it depends on. deps = %{browse: [], enrol: [:browse], open: [:enrol], track: [:open]} valid_order? = fn order -> Enum.with_index(order) |> Enum.all?(fn {rung, i} -> below = Enum.take(order, i) # rungs strictly below this one Enum.all?(deps[rung], &(&1 in below)) # every dependency is below end) end valid_order?.([:browse, :enrol, :open, :track]) # => true valid_order?.([:enrol, :browse, :open, :track]) # => false — enrol needs browse below it
The principle
Each rung depends only on the rungs below it — the ladder is a topological order — and where ordering by value and ordering by dependency disagree, dependency wins.
On the Portal
browse, enrol, open a lesson, track progress is the only order that builds; reorder enrol before browse and the dependency points upward — no longer a ladder.
Dependency order is the rule that each rung rests only on rungs below it, so value accrues from the bottom up — and a single upward edge is a violation.
Recap — a topological order
Dependency order is the rule that each rung depends only on the rungs below it, which makes the ladder a topological order of the dependency graph and means value accrues from the bottom up. Two sorts reconcile by precedence: dependency is the hard constraint, value the soft preference among independent rungs. With the order fixed, the last property follows on its own — every prefix of the ladder runs.
Next in A2.06: A2.06.3 · Always runnable — every rung leaves the system runnable and demoable, and skipping one out of order orphans the rungs above it.
References
Primary sources for ordering an increment plan by dependency and value, and where this connects in the course.
Sources
- Humble & Farley — Continuous Delivery — building an increment in an order that keeps each step releasable.
- Hunt & Thomas — The Pragmatic Programmer — small, deliberate steps that each rest on the ones before.
- Cohn, M. — User Stories Applied — ordering stories into a release plan by value and dependency.
Related in this course
- A2.06 · The value ladder — the module hub.
- A2.06.1 · Compose the ladder — the previous dive.
- A2.06.3 · Always runnable — the next dive.
- A2.03 · INVEST — Independent, the per-rung test the order relies on.
- A1.04 · Two layers — the roadmap that plans over the ordered ladder.
- Companion · Functional Programming in Elixir — the Portal's internals.