Example of neat specification
Train Seat Reservation Specification
Overview
This specification defines the rules and processes for reserving seats on a train using the web application. The application consists of two main views: Train View and Reservation View.
Business Rules
Reservation Limit per Train
No more than 70% of seats on the entire train may be reserved in advance.
Example: If the train has 100 seats, a maximum of 70 seats can be reserved.
Reservation Limit per Coach
Ideally, no individual coach should have more than 70% reserved seats.
Example: If Coach A has 20 seats, ideally, no more than 14 seats should be reserved.
Single Coach Reservation
All seats for one reservation must be within the same coach.
Example: If a user reserves 5 seats, all 5 seats must be in Coach A, not split between Coach A and Coach B.
Exception to Coach Limit
If reserving all seats in the same coach causes the coach to exceed 70% reserved seats, it is permissible as long as the entire train does not exceed 70% reserved seats.
Example: If Coach A has 20 seats and 13 are reserved, a reservation of 2 more seats (total 15) is allowed if the train's overall reservation limit is not exceeded.
Train View
Display: Visual representation of each coach with seats marked as reserved or empty.
Navigation: Option to go to reservation view or navigate to the next coach.
Reservation View
Input: Number of seats to reserve.
Output:
Booking reference (8 alphanumeric characters).
Reserved seats (list of seat identifiers).
Examples
Example 1: Simple Reservation
User Request: 3 seats.
Available Seats in Coach A: 20 seats (10 reserved).
Result: 3 seats reserved in Coach A.
Booking Reference: AZER1478.
Reserved Seats: A11, A12, A13.
Example 2: Reservation Exceeding Coach Limit
User Request: 5 seats in Coach A
Available Seats in Coach A: 20 seats (10 reserved).
Result: Request cannot be fulfilled as it would exceed the 70% reservation limit for the coach.
Feedback to User: "Unable to reserve 5 seats as it would exceed the 70% reservation limit for this coach. Please reduce the number of seats or check availability in other coaches."
Mind the exception of #
Example 3: Train Reservation Limit
User Request: 10 seats.
Total Seats in Train: 100 seats (65 reserved).
Result: Request cannot be fulfilled as it would exceed the 70% reservation limit for the entire train.
Feedback to User: "Unable to reserve 10 seats as it would exceed the 70% reservation limit for the entire train. Please reduce the number of seats or check availability in other coaches."
Example 4: Maximum Allowable Reservation, keep coach limit
User Request: 5 seats.
Total Seats in Train: 100 seats (65 reserved).
Available Seats in Coach A: 20 seats (5 reserved).
Available Seats in Coach B: 20 seats (10 reserved).
Result: 5 seats reserved in Coach A, total 10 reserved seats in Coach A (50 % reserved for Coach A and B), but total 70 seats reserved for the train (70% reserved for the train). We Avoid the reservation of Coach B because it will exceed the 70% reservation coach limit.
Booking Reference: PQWE5678.
Reserved Seats: B11, B12, B13, B14, B15.
Example 4: Maximum Allowable Reservation, exception of coach limit
User Request: 15 seats.
Total Seats in Train: 40 seats (10 reserved).
Available Seats in Coach A: 20 seats (5 reserved).
Available Seats in Coach B: 20 seats (5 reserved).
Result: 15 seats reserved in Coach A, total 20 reserved seats in Coach A (100% reserved for Coach A). But total 25 seats reserved for the train (62.5% reserved for the train).
Booking Reference: ER14QW96.
Reserved Seats: A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20.
Summary of Business Rules
Reservation Limit per Train
No more than 70% of seats on the entire train may be reserved in advance.
Reservation Limit per Coach
Ideally, no individual coach should have more than 70% reserved seats.
Single Coach Reservation
All seats for one reservation must be within the same coach.
Exception to Coach Limit
If reserving all seats in the same coach causes the coach to exceed 70% reserved seats, it is permissible as long as the entire train does not exceed 70% reserved seats.
Last updated