You are on page 1of 17

Use Case Diagram

: Library System

Books and journals The library contains books and journals. It may have several copies of a given book. Some of the books are for short term loans only. All other books may be borrowed by any library member for three weeks. Members of the library can normally borrow up to six items at a time, but members of staff may borrow up to 12 items at one time. Only members of staff may borrow journals. Borrowing The system must keep track of when books and journals are borrowed and returned, enforcing the rules described above. Browsing The system should allow users to search for a book on a particular topic, by a particular author etc., to check whether a copy of book is available for loan and, if not, to reserve the book. Anybody can browse in the library.

Use Case Diagram : Library Systems : Actor

BookBorrower

Browser

JournalBorrower

Librarian

Use Case Diagram : Library Systems : Use Case


Borrow copy of book Browse Extend loan

Update catalog Reserve book

Borrow journal

Use Case Diagram : Library Systems : Use Case Diagram


Borrow copy of book

Extend loan

BookBorrower

Reserve book

Browse

Browser

Return copy of book

Borrow journal

Update catalog

Librarian
Return journal JournalBorrower

Use Case Diagram : Library Systems : <<include>>


Borrow copy of book

<<include>>
Check for resevati on

<<include>>
Extend loan

BookBorrower

Use Case Diagram : Library Systems : <<extend>>

extends Borrow copy of book Refuse loan

BookBorrower

Use Case Diagram : Library Systems : <<extend>> with


extension point

Borrow copy of book ___________________ status validation: after confirming identity

extends Refuse loan too many books on loan

BookBorrower

Use Case Diagram : Library Systems : Generalization


Every human JournalBorrower is a BookBorrower
BookBorrower

JournalBorrower

Use Case Diagram: Library System


extends Refuse loan Borrow copy of book Check for resevati on Extend loan Browse Browser

BookBorrower

Reserve book

Update catalog Return copy of book Librarian

Borrow journal

Return journal JournalBorrower

Class Diagram
Identifying Classes

: Library System:

Take a list of candidates classes by underlining the nouns and noun phrases.

Books and journals The library contains books and journals. It may have several copies of a given book. Some of the books are for short term loans only. All other books may be borrowed by any library member for three weeks. Members of the library can normally borrow up to six items at a time, but members of staff may borrow up to 12 items at one time. Only members of staff may borrow journals. Borrowing The system must keep track of when books and journals are borrowed and returned, enforcing the rules described above.

Class Diagram
Identifying Classes

: Library System:

From the list of candidates classes, the following are discarded as they are obviously not good candidate class. library, because it is outside the scope of the system; short term loan, because a loan is really an event, the lending of a book to a user, which so far as we know is not useful object in this system; member of the library, redundant with library member; week, it is a measure of time, not a thing; item, it means book or journal; time, it is outside the scope of the system; system, it is part of meta-language of requirements description, not part of the domain; rule, for the same reason.

Class Diagram
Identifying Classes Possible classes:

: Library System:

LibraryMember

Copy

Book MemberOfStaff

Journal

Class diagram :
LibraryMember -borrows/returns 0..1

Library System
Copy 0..* 1..* -is a copy of

1 Book

MemberOfStaff

-borrows/returns 0..1 0..*

Journal

Sequence diagram :
theLibraryMember:LibraryMember

Library System
theBook:Book

theCopy:Copy

BookBorrower borrow()

okToBorrow() borrow() borrowed()

Collaboration diagram:
System

Library

:Book BookBorrower borrow() 2.1: borrowed()

2:borrow() :LibraryMember theCopy:Copy

1:okToBorrow()

State diagram :
return()
on loan

Library System
on the shelf

borrow()

Class Copy

return()/book.returned(self)
on loan on the shelf

borrow()/book.borrowed(self)

Class Copy with action

State diagram :

Library System

returned()
not borrowable borrowable

borrowed()[last copy] borrowed()[not last copy]

Class Book

You might also like