Hypothetical scenario. Northwind asks for an equipment-booking service. Maya wants discovery and recoverable confirmation; Priya asks how two employees requesting the same item over overlapping intervals can receive an honest answer. Dev reaches for a storage product before the interval rule has been written down.
Maya: “Keep this brief small enough to defend.”
Priya: “Make your own design first so the review can expose your assumptions rather than replace them.”
Stop and sketch the actor, accepted interval, confirmation and uncertain-response behavior before opening the guidance. This is an original fictional exercise for the completed core course, not an employer assessment or a prediction of interview performance. Keep recurring reservations and external calendars out of the first scope.
Which brief are you committing to defend?
The initial service handles authenticated employees within one organization, item discovery, interval availability, booking, cancellation and status lookup. Exclude recurring reservations, payments, external calendars and group bookings initially. Require that confirmed bookings for one item do not overlap under the selected interval rule. Availability search may be a derived view, but accepted confirmation must enforce that invariant.
Choose half-open intervals: the start belongs to the reservation and the end does not. A booking from nine to ten can therefore be followed by one from ten to eleven. The time zone, normalized storage representation and display rules still need definition; this simple interval notation does not settle daylight-saving behavior.
A caller can retry the same booking intention after a lost reply and recover its existing outcome. Cancellation needs authenticated authority and a current state transition. A cancellation notification does not itself release the reservation. The accepted cancellation state does, according to the chosen business rule.
Produce a design another person can challenge
Write a brief stating the supported actions, explicit exclusions and quality goals you would clarify. List the records needed for items, booking intentions, accepted intervals and cancellation. Draw the request path from authenticated submission to authoritative confirmation, then identify any derived availability index or cache.
Choose one concrete implementation mechanism for the non-overlap invariant. PostgreSQL range types and an appropriate exclusion constraint are one candidate; a carefully specified serial authority per item is another. Explain the actual transition and transaction boundary rather than writing atomic as a label. A read-then-insert sequence without a concurrency rule is incomplete.
Describe a lost confirmation and a concurrent cancellation. Name stable operation identity, current booking state and the result returned to the caller. Retain the difference between a conflict, a rejection and an unresolved request. Then state what happens if the authoritative store is unavailable while the availability cache still looks healthy.
Attempt the reservation packet before opening the model
Hypothetical scenario. Design exclusive equipment bookings for half-open intervals: a booking ending at 11:00 may coexist with one starting at 11:00. A search result is advisory. Acceptance needs an authoritative no-overlap transition, a tenant-scoped operation identity and a recoverable receipt.
| Deliverable | Your evidence | Adversarial test |
|---|---|---|
| Interface + record | Stable K, resource, interval, status | Lost reply retry |
| Invariant + authority | No active overlap | Two distinct concurrent users |
| Operating envelope | Peak / survivor / dependency work | Partition and cold recovery |
| Change plan | Mixed versions + owner epoch | Paused old writer |
Before opening the model answer, draw the booking interface, record key, interval predicate and lost-reply sequence. State the peak assumption independently from the existing daily means. Then change the condition: the authority partitions while two users request the same interval. Choose honest unavailable or conflicting outcomes without weakening exclusivity.
Use the visible rubric to test safety, progress assumptions, retry identity, overload, migration and ownership. A PostgreSQL range/exclusion design is one possible mechanism when its actual constraint matches resource, active state and interval semantics. Merely naming PostgreSQL, a lock or a transaction is not the argument. The model below is a separate reveal so the practice can remain an unseen design exercise.
Derive demand from the supplied assumptions
Hypothetical worked example. Select two thousand employees. Each starts three availability searches per workday and one booking attempt per workday. Search demand is 2,000 × 3 = 6,000 searches per day. Booking demand is 2,000 × 1 = 2,000 logical attempts per day. Keep searches and logical booking attempts separate from their internal database operations.
Select an eight-hour active day: 8 × 60 × 60 = 28,800 seconds. Mean search arrival is 6,000 ÷ 28,800 = 5/24 searches per second, approximately 0.2083. Mean booking arrival is 2,000 ÷ 28,800 = 5/72 attempts per second, approximately 0.0694. These averages are not peak provisioning requirements.
Select a morning interval with three hundred searches and one hundred booking attempts in sixty seconds. The rates are 300 ÷ 60 = 5 searches per second and 100 ÷ 60 = 5/3 booking attempts per second, approximately 1.6667. A single popular room can receive most of the write contention even while these aggregate rates look modest.
Choose one thousand bytes of logical payload per retained booking outcome and two thousand outcomes per day. Payload is 2,000 × 1,000 = 2,000,000 bytes per day. Across a selected thirty-day retention, 2,000,000 × 30 = 60,000,000 bytes, or sixty decimal MB. This excludes item data, indexes, audit details, replicas and actual storage allocation.
Use a visible rubric without turning it into proof
Score five dimensions from zero to two as a selected self-review aid: scope and assumptions; workload arithmetic; concurrency and authority; failure recovery; and explanation of alternatives and limits. Zero means absent or contradictory, one means partially explained, and two means explicit and consistent with the brief. The maximum is 5 × 2 = 10 points.
Scope earns full credit when actions, exclusions and the interval rule are explicit. Arithmetic earns full credit when units and denominators remain attached to calculations. Authority earns full credit when the exact non-overlap transition and retry identity are explained, including concurrent requests for one item.
Recovery earns full credit when a lost response can be reconciled and an unavailable authority does not produce an unsupported confirmation. Communication earns full credit when an alternative is compared against the same invariant and the next needed evidence is stated. A technology name alone does not earn the mechanism credit.
Do not release a broken invariant because the total looks good. Suppose a candidate earns two for scope, two for arithmetic, zero for authority, one for recovery and two for communication. Its total is 2 + 2 + 0 + 1 + 2 = 7, but the booking guarantee remains unestablished. The rubric guides feedback; the required invariant is a separate gate.
In the wild: interval constraints have a concrete mechanism
PostgreSQL documents range types and exclusion constraints, including overlap checks. Inspect the actual operator and constraint design before choosing it. A correct implementation must include the relevant item identity and active-state semantics; preventing all ranges from overlapping globally would reject unrelated rooms.
The documentation is not a complete booking design. Authorization, stable request identity, cancellation, time interpretation and operational recovery still belong to the application. Use the mechanism to enforce the chosen invariant, then explain the surrounding lifecycle rather than assuming the database feature settles the whole brief.
Two accurate availability reads lead to incompatible promises
Hypothetical failure scenario. Two employees read the same free interval before either inserts a booking. Both handlers create a row and send confirmation. A nightly conflict report notices the overlap later. The availability view was accurate when read, but the accepted transition never protected the invariant.
Reproduce the interleaving on paper before adding a cache or another worker. The correction belongs at authoritative acceptance. A later notification or compensation may help repair harm, but it does not satisfy a product promise that confirmed reservations never overlap under the selected rule.
Keep your first draft for the next review
Save the initial brief, diagram, arithmetic and decisions before consulting the next page. Mark assumptions and missing evidence plainly. A self-review is more useful when it can compare actual revisions rather than a polished answer that hides the original reasoning.
Use this exercise when you want to test transfer from familiar components to a different invariant. It is less useful as a memorization task: several implementations can satisfy the brief, and their operational costs differ. Ask a reviewer to challenge one exact transition, then revise the affected decision instead of replacing every component at once.
Compare your packet with the revealed model
Reveal model: what minimal packet satisfies the exclusivity and uncertain-reply tests?
Reveal the design reasoning
Store tenant-scoped K and fingerprint, protect active overlap for the same resource at the authoritative database transition, and commit the booking with a recoverable result. Retry K after a lost reply. During loss of that authority return pending or unavailable; do not grant from a stale search. State how expiry, cancellation and migration preserve the predicate.
Decision and reconsideration: Grade the supplied mechanism and counterexample, not a preferred stack. Keep unresolved workload assumptions explicit.
Check the design against changed conditions
The availability cache says free. Can it issue confirmation while the authority is unavailable?
Reason through the consequence
Not under the selected invariant. It may show provisional availability, but confirmation requires the authoritative acceptance mechanism.
A candidate scores seven out of ten but has no overlap protection. Is the design acceptable?
Reason through the consequence
No. The score is feedback, not a waiver of a required invariant. Fix authority before claiming that confirmations meet the product contract.
Two intervals meet exactly at the boundary. Do they overlap under the chosen rule?
Reason through the consequence
Not under half-open intervals when the earlier end equals the later start. State normalized time and display semantics separately; the interval notation alone does not settle them.
Keep your first draft, including choices you are unsure about. Page 69 critiques a deliberately incomplete candidate and demonstrates how to revise the affected decisions without replacing the original brief.
Northwind decision log
Freeze the booking invariant and workload before selecting components.
Use rubric scores for feedback while protecting mandatory boundaries.
Next, revise the candidate against a concrete concurrency critique.
Go deeper: Risk-driven modeling for a new brief
- Book chapter: Just Enough Software Architecture: chapter 3: Risk-Driven Model — George Fairbanks. Use this resource to examine which booking risk deserves detailed design.
- Book chapter: Just Enough Software Architecture: chapter 6: Engineers Use Models — George Fairbanks. Use this resource to examine models chosen to answer a concrete concurrency question.
- Video lecture: The Frustrated Architect — Simon Brown. Use this resource to examine architecture reasoning beyond a list of technology names.
- Primary document: Range Types — PostgreSQL project. Use this resource to examine the actual interval-overlap enforcement mechanism.