System Design Atlas

Hotel inventory and room pricing

02 / 10Worked example

Requirements

Which business rule protects a reservation, and how is its agreed boundary checked?

The case boundary defines business rules and measurable targets. The central invariant for reservation R-27 is that each confirmed reservation atomically occupies all required nights; occupancy never exceeds the local inventory for its room category. An invariant must hold after every completed operation. Quality targets describe measurable operational behavior.

Starting point Nights and price form a time-limited offer.

Assumptions for the example case

Own fictitious example design. One hotel, one room category, full nights and a fixed offer in EUR without prepayment. A price offer is valid for 300 seconds; at exactly 300 seconds, a new confirmation is rejected. All figures and test goals are illustrative assumptions.

Business guarantee and measurable limit

Guarantee and validation gates

1
Price offer A-27 validOffer version, two nights and 24,000 cents bound
2
Both nights availableCategory K-27 has remaining quantity per night
3
Commit togetherR-27 and both night allocations in one commit
Stand-alone time limitOffer valid before 300 s · expired at 300 s

A reservation atomically occupies all required nights without exceeding inventory.

Each confirmed reservation atomically occupies all required nights; occupancy never exceeds the local inventory for its room category.

Business requirements (functional)

Further reading
Durable commitment
Each confirmed reservation atomically occupies all required nights; occupancy never exceeds the local inventory for its room category.
Evidence and closure
Reception confirms completion of the stay.
Domain boundary rule
A price offer is valid for 300 seconds; at exactly 300 seconds, a new confirmation is rejected.

Operational goals (non-functional)

Further reading
Local processing
Illustrative target: 95% of local commands under 800 milliseconds in a 15-minute profile with 30 commands/s. External processing and human waiting time are measured separately.
Traceable processing
In the test profile, authoritative version and processing delay of channel reconciliation are recorded. Any accepted change to reservation R-27 must be demonstrable after restart based on its saved result.

Commit all nights of a stay together

Commit all nights of a stay together

Commit all nights of a stay together.

Each confirmed reservation atomically occupies all required nights; occupancy never exceeds the local inventory for its room category.

A price offer is valid for 300 seconds; at exactly 300 seconds, a new confirmation is rejected. The exercise specifies the input and expected result.

Alternative considered
A response-time target alone leaves invalid business states unchecked.
Trade-off
Strict validation can pause an operation for investigation.
Reassess
Measured processing times or new contracts with distribution channel require a renewed target check.

Try it yourself

Separate the business invariant from the 800-millisecond target. Explain the exact limit in this case.

A hint for your attempt

Completing an operation quickly but incorrectly does not satisfy the business guarantee.

Compare with a possible solution
Business rule
Each confirmed reservation atomically occupies all required nights; occupancy never exceeds the local inventory for its room category. The counterexample test checks the permitted state.
Operations and boundary
The 800-millisecond target applies to 95% of local commands in the assumed peak-load profile. A price offer is valid for 300 seconds; at exactly 300 seconds, a new confirmation is rejected.

Apply to your project

Which rule of your project remains binding even with slow processing?

Next: The last night determines the contention test.