System Design Atlas

Restaurant orders between service and kitchen

10 / 10Worked example

Design and evidence

Which tests prevent duplicate portions and cancellation that hides work already performed?

The final design reuses the complete runtime topology from step 6. Test markers connect key decisions to expected results and earlier steps to revisit. The following items form a test plan; measured evidence is still outstanding.

Starting point Give restaurant management the portion and its started state.

Assumptions for the example case

Our fictional example design covers one restaurant with table service, individual ordered portions, explicit kitchen acceptance, cancellation before preparation starts and recorded handover. Quantities and quality goals are illustrative test assumptions. Cash-register regulations, payment processing, automated allergen safety and delivery logistics are outside the scope.

Overall architecture with evidence

Runtime architecture · local operation with state channel

  1. 1 · Record locally
  2. 2 · Accept ticket
  3. 3 · Distribute state
  4. 4 · Record handover
Service terminalLocal queue
Kitchen displayStart + Complete
Management viewCases requiring review

Restaurant operations

Restaurant APIAcceptance + state commands
Portion and ticket databaseTickets · portions · receipts
State channelConfirmed changes
Service Terminal → Restaurant APITicket + Key
Restaurant API → Service terminalAcceptance / Status
Restaurant API → portion and ticket databaseTicket + portions
Portion and Ticket Database → State Channel Confirmed Changes
State channel → kitchen displayTicket states
Kitchen display → Restaurant APIStart + ready
Management view → Restaurant APICases requiring review
Restaurant API → Management viewOpen review list
Contention · Step 3/5Replay · Step 4Response loss · Step 7/9

The service terminal stores pending entries locally; the API and database track portions; the kitchen receives only committed changes.

The restaurant must keep working when central systems fail. The local API and portion database manage the kitchen workflow. Kitchen acceptance depends on a reachable local authority.

Test plan with review loops

ValidationExpected resultReturn to an earlier step
Concurrency in both ordersStarting and cancelling P-131 compete from angenommen. Cancellation first produces storniert and a conflict on start; start first produces in_zubereitung and a cancellation issue to resolve. Neither order may hide the portion or its work.Steps 3 and 5
Identical and changed retriesTransmit K-131 twice with identical content: The same two portions remain. A third portion under the same key causes a conflict. Repeating the handover record for P-131 results in exactly one handover.Step 4
Exact value or time limitAt a transmission age of 29,999 ms, the order remains pending. At 30,000 and 30,001 ms, flag it for investigation. This flag neither confirms kitchen acceptance nor starts a second portion.Steps 2 and 5
Lost response and restartThe kitchen accepts K-131, but the terminal loses the response. The terminal keeps transmission unconfirmed and queries the same order. Pressing Send again creates no additional soup or main-course portions.Steps 7 and 9

Concurrency in both orders

Expected result
Starting and cancelling P-131 compete from angenommen. Cancellation first produces storniert and a conflict on start; start first produces in_zubereitung and a cancellation issue to resolve. Neither order may hide the portion or its work.
Return to an earlier step
Steps 3 and 5

Identical and changed retries

Expected result
Transmit K-131 twice with identical content: The same two portions remain. A third portion under the same key causes a conflict. Repeating the handover record for P-131 results in exactly one handover.
Return to an earlier step
Step 4

Exact value or time limit

Expected result
At a transmission age of 29,999 ms, the order remains pending. At 30,000 and 30,001 ms, flag it for investigation. This flag neither confirms kitchen acceptance nor starts a second portion.
Return to an earlier step
Steps 2 and 5

Lost response and restart

Expected result
The kitchen accepts K-131, but the terminal loses the response. The terminal keeps transmission unconfirmed and queries the same order. Pressing Send again creates no additional soup or main-course portions.
Return to an earlier step
Steps 7 and 9

First end-to-end validation

End-to-end path
Test K-131 with response loss and concurrent cancellation. The two original portions and an unambiguous preparation-start outcome are preserved.
Open decision
Add courses and additional orders afterwards. Cash-register regulations, payment processing, automated allergen safety and delivery logistics require a separate follow-up design.

Prevent duplicate soup orders

Prevent duplicate soup orders

Test K-131 with response loss and concurrent cancellation.

The error lies between sending and accepting.

Two original portions and a clear starting result remain.

Alternative considered
A ticket-printing test does not verify the state model.
Trade-off
Kitchen actions must be simulable.
Reassess
After that, courses and re-orders will be supplemented.

Terms in this step

Prevent duplicate soup orders
Two original portions and a clear starting result remain.

Try it yourself

Define two tests for response loss and the race between starting and cancelling preparation, including the steps to revisit on failure.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Retry K-131 after a lost response: Exactly two portions remain. On failure, revisit steps 4 and 7.
Second part of the solution
Start and cancel in both orders: Each outcome has a clear state and preserves the work record. On failure, revisit steps 5 and 9.

Apply to your project

Which corresponding assumption in your project would you check first? Consider this trigger: Courses and additional orders are added afterwards.

Transfer the system boundary, evidence and open decisions to the editable Markdown 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

    Which corresponding assumption in your project would you check first? Consider this trigger: Local network reliability changes the failure assumptions.

    In the example: Display recorded and kitchen-accepted orders separately. A terminal click does not promise preparation.

  2. Requirements

    Which corresponding assumption in your project would you check first? Consider this trigger: Serving courses requires an additional coordinated release.

    In the example: Store a state for each portion. Service staff can see actual progress.

  3. Scale estimates

    Which corresponding assumption in your project would you check first? Consider this trigger: Larger events change the profile.

    In the example: Test 20 orders/min separately. The evening peak exceeds the daily average.

  4. Interfaces

    Which corresponding assumption in your project would you check first? Consider this trigger: Re-entering orders offline requires explicit conflict rules.

    In the example: Persist and compare K-131 and its content. Two portions remain two portions.

  5. Data and states

    Which corresponding assumption in your project would you check first? Consider this trigger: The kitchen defines points where preparation can be stopped automatically.

    In the example: Serialise both actions against the same portion version. Each winning order of execution has a visible consequence.

  6. Overall architecture

    Which corresponding assumption in your project would you check first? Consider this trigger: Several restaurants share resources that require binding allocation.

    In the example: The local API and portion database manage the kitchen workflow. Kitchen acceptance depends on a reachable local authority.

  7. Critical flow

    Which corresponding assumption in your project would you check first? Consider this trigger: The kitchen protocol provides no status query.

    In the example: Query the existing K-131. No second cooking order is created.

  8. Bottlenecks and trade-offs

    Which corresponding assumption in your project would you check first? Consider this trigger: New stations change the kitchen workflow.

    In the example: Measure time until preparation starts separately from transmission. The staffing bottleneck becomes visible in the workflow.

  9. Operations and security

    Which corresponding assumption in your project would you check first? Consider this trigger: An explicit goodwill policy is agreed.

    In the example: Give restaurant management the portion and its started state. Effort and the guest's decision remain traceable.

  10. Final design

    Which corresponding assumption in your project would you check first? Consider this trigger: Courses and additional orders are added afterwards.

    In the example: Test K-131 with response loss and concurrent cancellation. The two original portions and an unambiguous preparation-start outcome are preserved.