Interactions in the System 2

Suppoose that member wants to lend a book. First of all, member must be present in the library, the book for lending must be in paper format, and a free sample must be present in the library's storage. If all of these conditions are realized then a sample of book can be lended to the member.
To avoid going to the library and search for free sample, the member can perform a reservation to the Digital Library system, and after receiving a notification that a free sample for the reservation is present in the library, can go to the library and make his or hers lending.

Let's look at use cases in the Book package necessary for this operation.

The Book package

The book package use cases:
select an author check for reservations
receive an author data receive number of reservations
enter data for a new book find out the oldest reservation
edit data for an existing book make a reservation
enter multimedia data receive notification for reservation
receive notification from multimedia adding make a lending
check for free samples transmit lending data
receive number of free samples receive notification for lending

For process of lending we'll need these use cases: "make a lending", "transmit lending data", "receive number of reservations", "check for reservation" and "receive notification from lending". Let's take a look at steps of every use case.

- Make a lending
1 Activate the make/return lending part from the lender's interface.
2 A lending form appears on the lender's screen.
3 The lender enters the necessary data.
4 Lending data are transmited to the Digital Library
- Transmit lending data
1 The lender clicks the SUBMIT button on the lending form, and lending data is sent to the Digital Library
2 The Digital Library receives this data, and a request for new lending is sent to the Lending database
3 The request is sent to the Lending database, and an acknowledge is waited to receive

When data is transmited to the Lending database, a mechanizam for adding a new record in the database is activated. This operation incorporates these use cases located in the Lending package: "receive request for new lending", "perform a lending" and "transmit lending result". When performing a lending, also results from the Book package use cases are obtained. This process needs results for pending reservation made by that member for that book, and this will be done only if a result from "receive number of reservations" use case is not equal to zero. Checking for pending reservations is necessary, because if a reservation is made for a book ( a sample for that book is holded for the member), then when a lending is done, that reservation from Reservation database must be deleted.

- Receive request for new lending
1 The Lending database receives a request for performing a process of creating a new record
2 This activates the process of creating and adding a new record to the database
- Perform a lending
1 Database has activated its mechanizams for creating a new record
2 The result of creation a new record is aimed
3 This result is sent to the Digital Library
- Transmit lending result
1 Result from lending is sent to the Digital Library
2 This result is transmited to the lender's interface

Now we can continue with use cases from the Book package:

- Receive notification from lending
1 Lender's interface has received result from lending
2 This result is decoded, and a message is printed on a screen
3 A request for current state in the member's lending record is sent to the Lending database
4 A list of records is retreived form the Lending database
5 This list is printed on the lender's screen

The sequence diagram for these use cases steps is shown on the next picture:

lendingSequence.GIF (4268 bytes) The sequence diagram for "Make a lending"

As you can see some of use cases in the given list were not used for this purpose. They are internaly used in the activation of object in the Lending database. The operation for creation a record incorporates these use cases, and after that returns a result, that is dotted line message going out from the activation in the LendingDB lifeline.

For an exercise try drawing out the sequence diagrams for "return a lending" use case from the Book package, and for "enter data for a new journal" use case from the Journal package.

After you model interaction among components, the system is much closer to becoming reality. As you model the interactions, you may find that it's appropriate to modify the use cases at the base of these interactions. The results of this analysis should make it easy for programmers to code the system objects and how they communicate with one another.