Food Ordering System
Problem Statement
Design a Food Ordering System that allows customers to browse restaurants, view menus, place orders, make payments, and track delivery status.
The focus should be on object-oriented design, class structure, and interactions between components — not on UI or real-time services.
🔹 Problem Context
You are asked to design the core backend model for a food ordering platform similar to Swiggy, Zomato, or Uber Eats — focusing on how different entities (users, restaurants, food items, orders, and payments) interact.
The system should support:
✅ Functional Requirements
🧑💻 User Management
🍱 Restaurant & Menu
🛒 Ordering
💳 Payment
🚚 Delivery Tracking
🧾 Order History
⚙️ Non-Functional Requirements
Aspect with Description
Scalability
Should easily handle multiple restaurants and customers.
Extensibility
Support adding coupons, reviews, or loyalty programs later.
Reliability
Payment and order tracking should be consistent.
Maintainability
Clean separation between order, payment, and delivery logic.
Performance
Efficient search and filtering of restaurants/menus.
🧩 Core Classes and Responsibilities
Class with Description
User
Base class with common attributes like userId, name, email, phone.
Customer
Inherits from User; can browse, order, and pay for food.
Restaurant
Inherits from User; manages menu and accepts/rejects orders.
DeliveryPartner
Inherits from User; delivers food and updates status.
Menu
Holds a collection of MenuItem objects for a restaurant.
MenuItem
Represents a food item (name, price, category, availability).
Order
Contains details of items ordered, restaurant, customer, total amount, and status.
Cart
Temporarily stores selected items before order confirmation.
Payment
Handles payment logic, including type (UPI, card, etc.) and status (SUCCESS, FAILED).
OrderStatus (enum)
Defines order stages: PLACED, CONFIRMED, PREPARED, OUT_FOR_DELIVERY, DELIVERED.
PaymentType (enum)
Defines payment modes: CARD, UPI, WALLET, COD.
DeliveryService
Manages delivery assignment and updates.
OrderService
Handles order creation, update, and retrieval logic.
🧠 Key Design Considerations
💻 Example Scenario
🔮 Extensions
💬 Interview Prompt Summary
Design a Food Ordering System that enables users to browse restaurants, add items to a cart, place orders, and make payments.
Focus on class relationships and responsibilities for User, Restaurant, Menu, Order, Payment, and Delivery.
Ensure the system is extensible and maintainable.