Original practice scenario: A restaurant-order simulator supports meal bundles, ingredient modifiers and location-specific prices. How should its pricing function remain testable?
Read model answer +
Treat pricing as a deterministic transformation of a versioned menu and explicit order. Display names and mutable current prices should not determine historical order totals.
Work through it
Represent items, bundles and modifiers with stable identifiers, validate allowed combinations and retain the menu version used for the quote.
Calculate amounts using exact minor units and declared rounding rules, separating discounts, tax assumptions and fees in a transparent breakdown.
Test repeated modifiers, unavailable items, bundle substitutions, zero quantities and price changes between quote and confirmation; require explicit requoting when necessary.
Tradeoffs to discuss
Snapshotting prices makes receipts reproducible but requires an expiration policy for unconfirmed quotes and clear handling of menu changes.
Common pitfalls
Do not silently substitute an item or modifier with a different price.
The exercise's simplified tax rules should remain explicit fictional inputs.
Original practice scenario: A hypothetical restaurant chain changes its order-priority algorithm to reduce waiting time. Design an experiment that accounts for shared kitchen capacity.
Read model answer +
Orders sharing a kitchen interfere with one another, so customer-level randomization may not isolate the scheduling effect. Evaluate the policy at a unit and time scale matching that interference.
Work through it
Randomize stores or suitable time blocks with a planned crossover and washout where feasible, balancing baseline demand and operating patterns.
Predefine wait-time percentiles, cancellation, error and workload guardrails; analyze by assigned policy and account for clustering in uncertainty estimates.
Inspect peak periods, large orders and carryover effects, recording outages or protocol deviations without removing inconvenient outcomes after seeing results.
Tradeoffs to discuss
Store-level experiments reduce interference but need enough independent stores; time-block designs face carryover and changing demand.
Common pitfalls
Average wait improvement can hide severe tail delays.
Do not treat orders from the same kitchen as independent observations.