Use case diagrams • A use case diagram is UML’s notation for showing the relationships among a set of use cases and actors • A use case diagram can help the software engineer to convey a high-level picture of the functionality of the system
Library system use case diagram Example: Use-case diagram for a course registration system
Create Use Cases: Walk Through 1. 2. 3. 4. 5. Identify actors Define use cases Discover reuseable use cases Put uses into tables with id, name, primary actors etc. Write use case description for each use case • brief description • Basic flow • Alternative flow
Example
Identify Reuse In Use Case
Create use case index
Use case Description Use Case Number: 1 Use Case Name: Buyer Places a Bid Description: An EBAY buyer has identified an item they wish to buy, so they will place a bid for an item with the intent of winning the auction and paying for the item.
Basic Flow Next Describe the happy day scenario for your use cases such as "placing a bid". For a consumer to play a successful bid, what is the primary flow when everything goes as planned. An effective use cases needs to have the basic flow before moving forward with writing the alternate flows.
Alternative flow A few examples of alternate flows are: • credit card failed when a customer places an order, • user session times out when placing an order
Extensions • Used to make optional interactions explicit or to handle exceptional cases • By creating separate use case extensions, the description of the basic use case remains simple • A use case extension must list all the steps from the beginning of the use case to the end – Including the handling of the unusual situation
Generalizations • Much like superclasses in a class diagram • A generalized use case represents several similar use cases • One or more specializations provides details of the similar use cases
Inclusions • Allow one to express commonality between several different use cases • Are included in other use cases – Even very different use cases can share sequence of actions – Enable you to avoid repeating details in multiple use cases
Example of generalization, extension and inclusion Example: Use-case diagram for a home security system