Extension in use case diagram: Library management example

use-case

I have problem to understand the extension relation in the use case diagrams, sometimes some relations seem extension.

For example in the library system, what is the relation between borrowing a book use case and reservation a book use case?

enter image description here

Could the reservation be the extend of borrow?

Scenario of Reserve a book:

  • Member refers to the librarian
  • Gives the information of the book
  • Librarian record the book in the reservation list for the member

Scenario of Borrow a book:

  • Member refers to the librarian
  • Gives the information of the book
  • Librarian lend the book if it's available
  • Librarian reserve the book for the member if it's not available

In general what are rules of thumb to find out extension relation?

Best Answer

There are two relationships in a use case diagram - include and extend.

The extend relationship is used when one use case adds behavior to another use case. In this situation, the base case would be executed. Then, depending on what happens during execution of that one use case, one or more other use cases could possibly be executed. Note that it's not required that an extension actually be executed - it's just a possibility. This also indicates some level of reuse between the features.

The include relationship is used when one use case includes the functionality of another use case. The specific behavior is not important, but the end result is, which means that the included use case could have a different implementation, but the same steps and end result. In this type of relationship, the included use case is usually not available as a stand-alone use case.

Looking at your particular example, I developed two use case models that I feel are more appropriate. In both, I changed the actor from "Member" to "Librarian". It appears that the person actually interacting with the software is not the library member, but the librarian.

Inclusion Use Case

In this example, the Librarian can perform two functions - check out a book or reserve a book. Both examples require the librarian to look up the book using the information provided by the member. However, the search functionality is not available as a stand-alone entity. I'm not sure that this is what you are going for.

Extension Use Case

In this example, the Librarian can perform three functions - looking up books, checking out books, and recording reservations. Both checking out books and recording reservations use the look up book use case, but add additional behaviors. The implementation details are left as an exercise for additional specification, but this indicates that the in order to either check out a book or place a reservation, the librarian must first look up the book. I believe this is more in line with the functionality you are describing in your question.