8 - Motivation With the Library Problem, we saw that we...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
© 2010 by Spencer Rugaber Motivation • With the Library Problem, we saw that we could use a UML class model diagram to conceptualize the main participants in a problem and their relationships • The modeling process actually helped us improve the requirements by raising various issues • But there were significant limits on what could be expressed using only the diagram • We will now see how OCL annotations can be used to address these limitations
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2010 by Spencer Rugaber Class Model Diagram hasBeenRenewed : Boolean = false dueDate : Date /fine : Money whenReturned : Date = 0 CheckedOut * * computeOverdueFines () : Money itemsCurrentlyCheckedOut () : Set_LoanableItem checkOut (in i : LoanableItem ) request (in t : Title) whenDue (in i : LoanableItem ) : Date return (in i : LoanableItem ) renew (in i : LoanableItem ) cancelRequest (in t : Title) payFine (in item : LoanableItem ) name : String address : String phoneNumber : String libraryCardNumber : String birthDate : Date /age : Date Patron Item AudioVideoMaterial bestSeller : Boolean Book Magazine ReferenceBook name : String author : String isbn : String Title perDayFine : Money = .10 checkoutPeriod : Date value : Money LoanableItem 1 * NonLoanableItem * * Requests getDate () : Date «utility» OperatingSystem «utility» Money «utility» Date
Background image of page 2
© 2010 by Spencer Rugaber Library Problem Requirements 1. Each patron has one unique library card for as long as they are in the system. 2. The library needs to know at least the name, address, phone number, and library card number for each patron. 3. In addition, at any particular point in time, the library may need to know or to calculate the items a patron has checked out, when they are due, and any outstanding overdue fines. 4. Children (age 12 and under) have a special restriction–they can only check out five items at a time. 5. A patron can check out books or audio/video materials. 6. Books are checked out for three weeks, unless they are current best sellers, in which case the limit is two weeks. 7. A/V materials may be checked out for two weeks. 8. The overdue fine is ten cents per item per day, but cannot it go higher than the value of the overdue item. 9. The library also has reference books and magazines, which cannot be checked out 10. A patron can request a book or A/V item that is not currently in. 11. A patron can renew an item exactly once–unless there is a outstanding request for the item, in which case the patron must return it.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2010 by Spencer Rugaber Diagram • Which of these requirements did the diagram adequately address?
Background image of page 4
2010 by Spencer Rugaber Requirements that are Satisfied by the Diagram itself 2. The library needs to know at least the name, address, phone number, and library card number for each patron.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 51

8 - Motivation With the Library Problem, we saw that we...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online