Back to LLD explorer
Object-Oriented Design Patterns: Factory, Observer

Restaurant

Medium

Problem Summary

Design a Restaurant management system handling table reservations, dining orders, chef notifications, and bills.

Functional Scope

  • Support dynamic table status mapping (Free, Reserved, Occupied).
  • Process orders containing multiple menu items and customize chef alerts.
  • Calculate checks with optional tax, service fee, and discount vouchers.

Entity-Relationship (ER) Schema

Restaurant [1] <---> [*] Table
Table [1] <---> [0..1] Order
Order [1] <---> [*] MenuItem
Order [1] <---> [1] Bill

Design Approach

Table booking must be thread-safe to prevent double reservation. Use Observer to push active kitchen order updates directly to the chefs' display.

Core Classes & Models

Table (Capacity, State)Order (List of items, table reference, status)MenuItem (Name, Price, Category)Bill (Calculations, payments status)
Code Blueprint
public enum TableStatus { FREE, RESERVED, OCCUPIED }
public class Table {
    private TableStatus status = TableStatus.FREE;
    public synchronized boolean book() { return true; }
}