Courses / Machine Coding and Low-Level Design in TypeScript / Chapter 21
Module 8 · Design problems V: shopping, Q&A and restaurants · Chapter 21 of 28
Restaurant Management: Tables, Orders, Kitchen Tickets and Bills
Builds on Solving a Design Problem: Requirements to Tested Code in Six Steps, Design Patterns in TypeScript: Creational, Structural and Behavioural and Parking Lot: Floors, Spots, Tickets and Fees. Next up: Social Network: Friends, Posts, Privacy and the News Feed.
Part 1 · Requirements
What the restaurant must do
A restaurant is a small factory with a queue at every station: guests wait for tables, dishes wait for cooks, and the bill waits for the last dish. This chapter builds the logic for a Kolkata restaurant with four tables and a kitchen of three stations.
A requirement is a sentence about the system that someone can check. Functional requirements say what the system does, and we write them before any class exists. For the restaurant, they are these.
- The restaurant has tables with a number of seats. A party can book a table ahead for a time, or walk in and be seated at a table that is free.
- A waiter opens an order for a table and adds items from the menu, each with a quantity.
- Each menu item belongs to a kitchen station: the tandoor, the curry station or the beverages bar. When the waiter fires an order, the kitchen gets one ticket for each station that has work.
- Each station cooks its items in the order they arrived. An item moves from placed to cooking to ready to served, and can be cancelled until it is served.