Preparing your design workspace

Loading the problem and your saved attempt…

Design a Library Circulation System

Design and implement a library circulation system with titles, physical copies, members, loans, holds, extensible policies, and atomic checkout and return behavior.

For this exercise, assume a library manages bibliographic titles and individually barcoded physical copies. Members can search titles, borrow an available copy, return a loan, and place or cancel one FIFO hold per title. A member may hold at most five active loans for fourteen days.

A member may also check out the same title, using any of its copies, at most three times in total: every successful checkout counts, whether that loan is still active or already returned, a return does not reset the count, and a refused checkout or a retried request does not count.

A fourth checkout of that title is refused with its own title-checkout-limit outcome while the member's other titles are unaffected; a member who has reached the limit for a title cannot place a hold on it, and a returned copy is never reserved for such a member.

A returned copy is reserved for the earliest eligible hold before becoming generally available. Librarians add or retire copies and may configure member categories and lending policies.

Checkout of one copy must be atomic under concurrent requests; fines, digital books, inter-library transfer, and payment collection are outside scope.

Design the classes, responsibilities, interfaces, interactions, errors, and extension points for different member and book categories without encoding every policy in one class.

Then implement the in-memory checkout and return application services against supplied repository, policy, clock, and transaction interfaces. The implementation must return typed outcomes, make same-input request retries idempotent, and preserve atomic copy, loan, and hold-reservation state transitions.

UI, database drivers, background jobs, and a complete production server remain outside scope.