Courses / Machine Coding and Low-Level Design in TypeScript / Chapter 25
Module 10 · Design problems VII: airlines, cricket and careers · Chapter 25 of 28
Airline Management: Flights, Seats, Bookings and Crew
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: Live Cricket Scores: Innings, Overs, Ball-by-Ball Events and Commentary.
Part 1 · Requirements
What the airline must do
A domestic airline sells seats on dated flights, and every dated flight is cut from a weekly timetable. This chapter builds a small version with four airports, parties of passengers, a crew list and a day when a flight is cancelled.
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 an airline flying between Delhi (DEL), Mumbai (BOM), Bengaluru (BLR) and Hyderabad (HYD), they are these.
- A schedule entry says that flight ZA101 leaves Delhi for Mumbai at 09:15 on Mondays, Wednesdays and Fridays. A flight is one dated trip cut from it, such as ZA101 on 2 December. Passengers book flights, never schedule entries.
- Each flight has an aircraft seat map: rows of seats in two cabins, business and economy. We call the cabin the fare class and give each class one price.
- A booking is for a party of one to six passengers in one cabin. The booking gets a six-character booking reference and holds seats for the whole party or for nobody.