Jump to a problem, path or page
Jump to a problem, path or page
01 · Frame the problem
Design a room scheduling library for one-time meetings. Rooms have capacity and equipment requirements. Concurrent requests may select overlapping times, and editing a meeting must not lose its original reservation on failure.
Scheduling correctness depends on interval semantics and shared overlap enforcement. Time-zone interpretation must be resolved before comparing instants, and failed rescheduling must preserve the existing reservation.
02 · Find the design pressure
Begin with half-open intervals and room-scoped ownership. A controller-side availability check races another booking. Enforce overlap prevention in the repository transaction, with version guards for reschedule/cancel and a clear adjacent-booking rule.
03 · Define success
04 · Identify the correctness boundary
Normalize user times into explicit instants and retain the originating time-zone policy where needed. Half-open intervals permit adjacent reservations. Overlap prevention belongs in the shared repository transaction, and rescheduling validates a staged replacement before releasing the current reservation.
05 · Make it concrete
Booking [10:00,11:00) and [11:00,12:00) can share a room. A request for [10:30,11:30) conflicts. If rescheduling the first booking into an occupied period fails, its original interval remains booked. Concurrent creates cannot both pass an unprotected check-then-insert overlap test.