Part 2 of 6 · 2 min read
Requirements
Browse, hold, pay, confirm.
Think of a theatre box office with a clipboard. A person picks seats. The clerk pencils their names in, so nobody else is sold those seats while the person finds their wallet. If the person walks away, the clerk rubs the pencil out after ten minutes. If they pay, the clerk inks the names. The pencil step is the hold, and the ink step is the confirmation.
Questions and the answers assumed here:
- What is sold? Seats for one show. A show is a movie in a screen at a start time.
- Can a person pick several seats? Yes, and either all are theirs or none are.
- What happens between picking and paying? The seats are held for a fixed time, such as 10 minutes.
- What if the hold runs out? The seats go back on sale.
- How is the price set? By a rule, which may depend on the seat.
- Many buyers at once? Yes.
- Out of scope: real payments, refunds, and seat-map drawing.
The numbered requirements:
- R1. A show has a seat map of rows and numbered seats.
- R2. A buyer may hold one or more free seats. If any one is taken, no seat is held.
- R3. A hold lasts a fixed time and then stops counting.
- R4. Confirming a live hold turns the seats into a booking with a total price.
- R5. Confirming an expired hold fails and frees the seats.
- R6. A seat is never in two holds or bookings at once.
- R7. The price comes from a replaceable rule.
The nouns are show, seat, seat map, hold, booking and price rule. Seat is a record, a value that compares by content (Level 5, module 2). A Hold and a Booking are also records, since neither changes after it is made.
Hold
A hold is a temporary claim on seats that lasts for a limited time. If it is not confirmed in time, it ends and the seats are free again.
Example: seats A1 and A2 held for 10 minutes while the buyer enters payment details.
Check yourself: 1. Why is a multi-seat hold all-or-nothing? 2. What happens to seats when a hold expires? 3. Which classes are records, and why?