ooad1-3 Exercise 1: The 'Return a Book' Use Case ==================================================== USE CASE: Return a Book Scope: Library lending system (black box) Goal level: User goal Primary actor: Librarian, acting for a Member at the desk Stakeholders: Member (wants to be told clearly about any fine) Library (wants the book back on the shelf, or in the right place, and fines recorded) Precondition: The Librarian is signed in. Trigger: A Member hands back a book. Success guarantee: The loan is closed, the copy's status is correct (available, held, or withdrawn), and any fine is recorded. Minimal guarantee: If the return is refused, nothing has changed. MAIN SUCCESS SCENARIO 1. The Member hands the book to the Librarian. 2. The Librarian enters the book's ISBN. 3. The system finds the open loan for that copy. 4. The system checks the book is back by its due date. 5. The system closes the loan and marks the copy available. 6. The system confirms to the Librarian. EXTENSIONS 3a. There is no open loan for that copy: 3a1. The system says the copy is not on loan. Use case ends. 4a. The book is overdue: 4a1. The system works out the fine (assumption: 10p per day) and adds it to the Member's fines. 4a2. The system tells the Librarian the amount to mention. Continue at step 5. 5a. Another Member is first in the reservation queue for this title: 5a1. The system marks the copy as held for that Member instead of available, and tells the Librarian to put it on the hold shelf. 5b. The Librarian reports the book is damaged: 5b1. The system withdraws the copy from stock instead of marking it available. RULES I HAD TO ASSUME (ask the librarian) - 10p per day overdue, no cap, no grace day. - A damaged book is withdrawn even if another Member is waiting (see exercise 3 for what that leaves open). - Fines are added to the Member's balance rather than demanded at the desk. - Who may mark a book as damaged: the Librarian alone, at the desk. WHY THIS WORKS AS AN ANSWER --------------------------- The main scenario is six short steps with no decisions in it; every decision is an extension attached to the step where it happens. 4a continues at step 5 because an overdue book is still returned; 3a ends the use case because there is nothing to return. 5a and 5b both change what step 5 does, so they share its number. The minimal guarantee is a promise about refusal, and the success guarantee names all three possible copy statuses, which is what forces the extensions to be written. Stakeholders are listed because the Library's interest (the book in the right place) is what motivates 5a.