Software Development Process 8 | Library System Case Study

Series: Software Development Process

Software Development Process 8 | Library System Case Study

  1. Requirements
  • Each patron has one unique library card for as long as they are in the system.
  • The library needs to know at least the name, address, phone number, and library card number for each patron.
  • 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.
  • Children (age 12 and under) have a special restriction — they can only check out five items at a time.
  • A patron can check out books or audio/video Materials.
  • Books are checked out for three weeks unless they are currently bestsellers, in which case the limit is two weeks.
  • A/V materials may be checked out for two weeks.
  • The overdue fine is ten cents per item per day, but cannot be higher than the value of the overdue item.
  • The library also has reference books and magazines, which can’t be checked out
  • A patron can request a book or A/V item that is not currently in.
  • A patron can renew an item once (and only once) unless there is an outstanding request for the item, in which case the patron must return it.

2. Nouns: Classes and Attributes

  • Each patron (Class) has one unique library card (Class) for as long as they are in the system (Class).
  • The library needs to know at least the name (Attr), address (Attr), phone number (Attr), and library card number (Attr) for each patron.

We can store these values in different classes,

  • In addition, at any particular point in time (Class), the library may need to know or to calculate the items (Class) a patron has checked out when they are due, and any outstanding overdue fines (Class).
  • Children (Class) (age (Attr) 12 and under) have a special restriction — they can only check out five items at a time.
  • A patron can check out books (Class) or audio/video (Class) Materials.
  • The library also has reference books (Class) and magazines (Class), which can’t be checked out
  • Books are checked out for three weeks unless they are current bestsellers (Class), in which case the limit is two weeks.
  • A/V materials may be checked out for two weeks.
  • The overdue fine is ten cents (Class) per item per day, but cannot be higher than the value (Attr) of the overdue item.
  • A patron can request a book or A/V item that is not currently in.
  • A patron can renew an item once (and only once) unless there is an outstanding request for the item, in which case the patron must return it.

3. Refine: Classes and Attributes

We have a number of classes. So let’s see if there’s some class that may be superfluous and we can model in a different way.

  • The library card is just an ID: add to Patron as an attribute
  • Children class is unnecessary and it may be hard for changing the status of a patron if the child grows up
  • We can eliminate the bestseller because it is also a kind of books
  • System class is also unnecessary because we can maintain all the information in the Patron class

4. Adding Attributes

  • We have to keep track of the due date for each item, so it is better if we add a dueDate attribute
  • Item can only be renewed by one time so we have to keep track of it
  • A patron can check out the item, so we’d better show that
  • The reference books can not be checked out so we have to add another attribute to the item to show if it is loanable

5. Verbs: Operations

  • Each patron has one unique library card for as long as they are in the system.
  • The library needs to know at least the name, address, phone number, and library card number for each patron.
  • 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.
  • Children (age 12 and under) have a special restriction — they can only check out five items at a time.
  • A patron can check out books or audio/video Materials.
  • Books are checked out for three weeks unless they are currently bestsellers, in which case the limit is two weeks.
  • A/V materials may be checked out for two weeks.
  • The overdue fine is ten cents per item per day, but cannot be higher than the value of the overdue item.
  • The library also has reference books and magazines, which can’t be checked out
  • A patron can request a book or A/V item that is not currently in.
  • A patron can renew an item once (and only once) unless there is an outstanding request for the item, in which case the patron must return it.

6. Adding Relationships

  • The Patron can check out an Item
  • The Patron can also request an Item
  • Book, AVM, RB, and Magazine are specifications of Items
  • Add an intermediate class for classifying loanable items and non-loanable items,

7. Fix Multiple Items Problem

  • The title is different from the item because we can have several items with the same title. So basically, we need another class called Title and it has an association related to the Items.
  • Also, we can only check out loanable items, so we have to change the checkedOut relation

8. Fix the Loan Problem

  • We can make things clear by split the loan attributes and the ordinary loanable item attribute value,
  • Then we can just put fine as an attribute in the CheckedOut class so that we can make this information specified to a checkout record
  • Also, if Patron returns the book but doesn’t pay the fine, we have to track it. So

9. Final Considerations

So here is a final picture we can deliver for the system.