Model the Uber Eats Order Lifecycle as an Enforced State Machine

Last updated: November 29, 2026

Quick Overview

Implement an order object for Uber Eats whose status moves through placed, accepted, preparing, ready, picked up, delivered, or cancelled, rejecting illegal transitions and transitions by the wrong actor, and notifying listeners on each change.

Uber
Software Engineering Fundamentals
Software Engineer
Uber
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement an order object for Uber Eats whose status moves through placed, accepted, preparing, ready, picked up, delivered, or cancelled, rejecting illegal transitions and transitions by the wrong actor, and notifying listeners on each change.

Eats orders are touched by eaters, merchants, couriers, support, and automated systems, often with retries and out-of-order events. The interviewer checks an explicit transition table, actor permissions, duplicate event handling, and optimistic concurrency.

What the Interviewer Expects
  • Represent states with an enum and transitions in a table, not scattered ifs
  • Check both target state and acting role
  • Treat a repeated event to the current state as a no-op
  • Use a version for optimistic concurrency
  • Emit change events for notifications and analytics
Key Topics to Cover
State machines
Enums
Authorization
Optimistic concurrency
Observer pattern
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • A courier's picked-up event arrives before the merchant's ready event. What should happen?
  • How do you persist this so two services cannot both apply a transition?
  • How would you add a 'courier reassigned' sub-state without breaking callers?
  • What would you log for support to reconstruct a disputed order?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Allowed path: placed, accepted, preparing, ready for pickup, picked up, delivered. Cancellation is allowed early by the eater and later only by support. Each transition is validated, versioned, record...

High-Level Design

A transition table maps current -> {next: allowed_actors}. That makes rules reviewable at a glance and easy to test exhaustively. transition() checks the expected version (if given), short-circuit...


Submit Your Answer
Markdown supported