Jump to a problem, path or page
Jump to a problem, path or page
01 · Develop the design
Model room reservations as half-open intervals of explicit instants. Enforce overlap prevention in the durable repository and make creation, rescheduling and cancellation idempotent or version guarded.
Stage 1
Write the overlap predicate
Intervals overlap when existing.start < requested.end and requested.start < existing.end. Use the same rule throughout.
Stage 2
Resolve time at the API boundary
Use explicit instants or a local date/time plus zone and offset policy. Reject ambiguous/nonexistent local time unless the caller resolves it.
Stage 3
Treat edits as versioned replacement
Lock or version-check the reservation. Check conflicts excluding itself and update the reservation in one transaction.
02 · Work through the method
03 · Justify the choices
Do [10:00,11:00) and [11:00,12:00) overlap?
No, half-open intervals permit back-to-back meetings
Half-open intervals exclude their end instant and provide an unambiguous boundary rule.
What prevents concurrent double booking?
A transactional overlap constraint or serialized room claim
The conflict check and insertion must be one shared atomic operation.
What if a reschedule conflicts?
Keep the original reservation unchanged
Validate and commit replacement atomically so a failed edit cannot discard the existing booking.
04 · Plan the evidence