Design Dominos delivery system
Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2019-12-17
Problem Statement
Design a Domino’s-like pizza ordering and delivery system. The system should allow customers to browse menu items, place customized orders, make payments, track the order lifecycle, and get deliveries assigned to agents. Focus is on object-oriented modeling, class relationships, and service responsibilities (not UI or physical kitchen hardware).
Functional Requirements (FR)
User & Customer Management
•Customers can register/login and maintain profile info (name, addresses, phone, payment methods, order history).
Menu Management
•Menu contains pizzas, sides, drinks, combos.
•Pizzas support customizations (size, crust, toppings).
•Prices may vary based on size or offers.
Order Management
•Place order for delivery or pickup.
•Support multiple items per order.
•Track status: Placed → In Kitchen → Ready → Out for Delivery → Delivered.
•Allow cancel or modify order (before preparation).
Kitchen Management
•Queue orders for preparation.
•Assign to chefs.
•Update status to “ready”.
Delivery Management
•Assign delivery agents based on location & availability.
•Real-time tracking of delivery agent.
•Update delivery status.
Payment & Billing
•Support cash, card, wallets, UPI.
•Validate payment and link with order.
•Handle refunds for canceled orders.
Notifications
•Notify customers when status changes.
•Notify delivery agents when they are assigned.
Non-Functional Requirements (NFR)
•Scalability: Handle thousands of orders simultaneously.
•Low Latency: Real-time order tracking and updates.
•Reliability: No lost orders between kitchen & delivery.
•Extensibility: Easy to add new menu items, offers, or new delivery models (dine-in, takeaway).
•Security: Secure payments and user data storage.
Core Entities & Attributes
•User (Customer) → userId, name, addresses, orderHistory
•MenuItem → itemId, name, category, price, customizations[]
•Pizza (extends MenuItem) → size, crust, toppings[]
•Order → orderId, customerId, items[], totalAmount, status, paymentId
•OrderItem → menuItem, quantity, customization
•Payment → paymentId, amount, method, status
•DeliveryAgent → agentId, name, currentLocation, availability, assignedOrders[]
•Kitchen → orderQueue, assignOrder(), markReady()
•NotificationService → sendToUser(), sendToAgent()
Key Operations / APIs
•viewMenu()
•placeOrder(customerId, items[], paymentInfo)
•trackOrder(orderId)
•cancelOrder(orderId)
•assignDelivery(orderId, agentId)
•updateOrderStatus(orderId, status)
•processPayment(orderId, method)
Design Considerations
•Concurrency: Handle multiple orders and agent assignments in parallel.
•Design Patterns:
•Factory → create pizza objects with chosen customizations.
•Observer → push notifications on order status change.
•Strategy → different payment methods.
•Extensibility: Support coupons, loyalty points, or third-party delivery integration later.
✅ This problem tests:
•OOP class modeling (Orders, Menu, Kitchen, Delivery, Payment).
•Service interactions (kitchen ↔ delivery ↔ customer).
•Concurrency and extensibility handling.