System Design Atlas

Multimodal journey planning

10 / 10Worked example

Final design

The design demonstrates consistent travel alternatives. Which conditions ensure a valid result?

A beautiful route map hides snapshot errors.

Starting point Real-time data older than 90 s is marked.

Assumptions for the example case

A fictional journey planner for buses, trains and walking routes in one region. Each response binds a timetable version and a real-time snapshot. The scope ends with journey information, without a booking commitment. All quantities, thresholds and operational objectives are illustrative assumptions.

Information with test markers

Import and search in parallel

Journey interfaceInformation
Journey information APIPin a snapshot
Search worker poolCalculate routes
Timetable graphImmutable generation
Real-time snapshotAppropriate status
Response cacheSnapshot + Preference
Import processValidate + Activate
Active pointerGeneration
Transport data providersExternal
Journey interface → Journey information APIQ-41
Journey information API → Active pointerAtomically pin the generation + real-time snapshot
Journey information API → Search worker poolPass the pinned snapshot
Search worker pool → Timetable graphRead generation
Search worker pool → Real-time snapshotRead matching snapshot
Search worker pool → Response cacheComplete key
Transport data provider → Import processTimetable + real-time data
Import process → Timetable graphNew immutable generation
Import process → Active pointerActivate generation atomically

The import activates a generation through an atomic pointer update; each request pins the graph and real-time snapshot before searching.

The architecture from step 6 includes test markers at the worker's transfer boundary, the snapshot pointer and the response path's time budget, with links back to steps 2, 5 and 7.

Test plan with expected outcomes

Input and initial stateExpected resultReturn to an earlier step
Active generation=7 → Import A/B and B/A respectively baseGeneration=7Exactly one import activates generation 8; the loser receives a conflict. Generations remain separate.Step 5
Q-41 completes with origin=a and destination=b → retry identically, then use destination=c under the same keySame answer; altered search conflict.Step 4
Arrival 10:00, footpath 180 s, buffer 120 s → departure 10:04:59 /10:05:00 /10:05:01The first transfer is invalid; the other two are valid.Step 2
Budget 800 ms → No complete candidate or two complete candidates at the end of the budgetRespectively: timeout, or a partial result with exactly two validated routes. Neither proves that no route exists.Step 7

Active generation=7 → Import A/B and B/A respectively baseGeneration=7

Expected result
Exactly one import activates generation 8; the loser receives a conflict. Generations remain separate.
Return to an earlier step
Step 5

Q-41 completes with origin=a and destination=b → retry identically, then use destination=c under the same key

Expected result
Same answer; altered search conflict.
Return to an earlier step
Step 4

Arrival 10:00, footpath 180 s, buffer 120 s → departure 10:04:59 /10:05:00 /10:05:01

Expected result
The first transfer is invalid; the other two are valid.
Return to an earlier step
Step 2

Budget 800 ms → No complete candidate or two complete candidates at the end of the budget

Expected result
Respectively: timeout, or a partial result with exactly two validated routes. Neither proves that no route exists.
Return to an earlier step
Step 7

End-to-end test and unresolved agreements

First end-to-end path
Calculate a journey with one transfer against a fixed snapshot. Activate an import concurrently, vary the transfer boundary and exhaust the time budget both with and without complete candidates.
Clarify before real use
Agree accessibility data, international time-zone handling, provider associations and realistic buffer rules before expanding the design.

The design demonstrates consistent travel alternatives.

The design demonstrates consistent travel alternatives.

The end-to-end test combines an import version switch and the minimum transfer-time boundary.

A beautiful route map hides snapshot errors.

The activation pointer and worker must preserve one data version; on failure, revisit step 5. The response path distinguishes partial results, timeout and no route; on failure, revisit step 7.

Alternative considered
Testing only successful standard searches leaves the critical branches untested.
Trade-off
Test requires controlled time and activation order.
Reassess
Add further modes of transport after obtaining this evidence.

Try it yourself

Associate the snapshot and time-budget tests with the relevant component and the step to revisit on failure.

A hint for your attempt

A beautiful route map hides snapshot errors.

Compare with a possible solution
Snapshot
The activation pointer and worker must preserve one data version; on failure, revisit step 5.
Budget
The response path distinguishes partial results, timeout and no route; on failure, revisit step 7.

Apply to your project

How does this principle apply in your own project: The design demonstrates consistent travel alternatives.

Transfer the decisions and their counterexamples to the editable design template.

Start your own design

Choose a small case from your project. The template collects the ten design tasks and leaves space for your sketches, decisions, and open assumptions. You can edit it in your text editor or note-taking app.

Download design template (.md)
Compare the ten tasks with the example case
  1. Purpose and boundary

    How does this principle apply in your own project: Journey information describes a possible route.

    In the example: Responses state the data version and freshness.

  2. Requirements

    How does this principle apply in your own project: Equality is sufficient for a connection in this model.

    In the example: At least 300 s of transfer time is required.

  3. Scale estimates

    How does this principle apply in your own project: Peak search load differs from the daily average.

    In the example: Test overall load and origin-destination hotspots separately.

  4. Interfaces

    How does this principle apply in your own project: New data requires a new search.

    In the example: queryKey binds the input and completed response version.

  5. Data and states

    How does this principle apply in your own project: Generations prevent mixed timetable versions.

    In the example: Activation atomically swaps a pointer.

  6. Overall architecture

    How does this principle apply in your own project: Imports and queries have separate runtimes.

    In the example: The import process and search worker write and read versioned artifacts respectively.

  7. Critical flow

    How does this principle apply in your own project: Exhausting the search budget does not prove that no route exists.

    In the example: Partial results contain only fully validated candidates.

  8. Bottlenecks and trade-offs

    How does this principle apply in your own project: Search expansions explain slow queries.

    In the example: Measure expansion count and data access time separately.

  9. Operations and security

    How does this principle apply in your own project: Data age remains visible.

    In the example: Real-time data older than 90 s is marked.

  10. Final design

    How does this principle apply in your own project: The design demonstrates consistent travel alternatives.

    In the example: The end-to-end test combines an import version switch and the minimum transfer-time boundary.