Book Example
To illustrate our process, we detail the book example which is the implementation of a library.
Before reversing sequence diagrams we need some knowledge of the program structure. The following figure shows excerpts from the class diagram that is automatically reversed by EclipseUML.
This reveals two abstract classes and several classes that inherit from them. It is not easy to understand the behavior because the methods are small, and make extensive use of delegation to other objects. The global flow is thus very distributed and a dynamic analysis is clearly necessary.
In this case study, we focus on the behavior of the class Book. We choose some test cases that manipulate only one book. When a book is added to the library, it is ordered and must be delivered before it can be borrowed. In the first test case the book is delivered, then it is borrowed by a user, who damages the book and returns it. Then the book is fixed (which makes it not available) and it is delivered again to the library. In the second test cases, the book is reserved once before it is delivered, then it is borrowed and returned back. Those test cases are simple as there is only one book and one user but it covers most of the possible actions in the system.
The following figure shows the sequence diagram produced with the execution of two test cases.
The following figure shows the sequence diagram reversed when only the first test case is executed. A high level loop is still detected but it is clearly less accurate than the first result.