Part 4 of 7 · 1 min read
A class diagram for the room system
Put the boxes and lines together.
For the module 2 list, a whiteboard sketch can be this small:
BookingService -----> Booking * ----- 1 Room
|
*--> TimeSlot
|
--> BookingStatus (enum)
Reading it: the service holds many bookings. Each booking has one room, one slot and a status. The service is the only class that can see all bookings, so it enforces the no-overlap rule.
The next step is to ask whether the design survives a change. For "add repeat bookings", the sketch suggests a RepeatRule attached to Booking, and no change to Room. That conversation is worth more than extra boxes.
Check yourself:
1. Which class enforces the no-overlap rule, and why?
2. Where would a RepeatRule attach?
3. What question follows every sketch?