Friday 21 December 2012

Relationship among Use Cases

3.9 Relationship among Use Cases

The UML allows us to extend and reuse already defined use cases by defining the relationship among them. Use cases can be reused and extended in two different fashions: extends and uses. In the cases of “uses” relationship, we define that one use case invokes the steps defined in another use case during the course of its own execution. Hence this defines a relationship that is similar to a relationship between two functions where one makes a call to the other function. The “extends” relationship is kind of a generalization specialization relationship. In this case a special instance of an already existing use case is created. The new use case inherits all the properties of the existing use case, including its actors.

Let is try to understand these two concepts with the help of the following diagrams. In the case of the first diagram, the Delete Information use case is using two already existing use cases namely Record Transaction and Cancel Transaction. The direction of the arrow determines which one is the user and which use case is being used.

Use Case Transaction - Click to Enlarge
Use Case Cellular Telephone - Click to Enlarge

The second diagram demonstrates the concept of reuse by extending already existing use cases. In this case Place Conference Call use case is a specialization of Place Phone Call use case. Similarly, Receive Additional Call is defined by extending Receive Phone Call. It may be noted here that, in this case, the arrow goes from the new use case that is being created (derived use case) towards the use case that is being extended (the base use case).

This diagram also demonstrates that many different actors can use one use case. Additionally, the actors defined for the base use case are also defined by default for the derived use case.

The concept of re-usability can also be used in the case of actors. In this case, new classes of actors may be created by inheriting from the old classes of actors.

Credit Card Validation System - Click to Enlarge
In this case two new classes, Individual Customer and Corporate Customer, are being created by extending Customer. In this case, all the use cases available to Customer would also be available to these two new actors.

In the next post we will discuss about Elaborated Use Case.

No comments:

Post a Comment