Software Engineering
Use Case Diagrams

Course Map

Agenda


User Stories


Use Cases


Use Cases and Actors(UML 2 Use Case Diagram Specification)

Use case diagrams describe what a system does from the standpoint of an external observer. The emphasis is onwhata system does rather thanhow.Use Case analysis is one of the first and primary means of gathering requirements in the behavioral methodology. Use cases are a standard technique for gathering requirements in many modern software development methodologies.

Use case diagrams are closely connected to scenarios. A scenario is an example of what happens when someone interacts with the system. Here is a scenario for a medical clinic.

Ause case is a summary of scenarios for a single task or goal. An actor is who or what initiates the events involved in that task. Actors are simply roles that people or objects play. The picture below is a Make Appointment use case for the medical clinic. The actor is a Patient. The connection between actor and use case is a communication association (or communication for short).

Use case

Actors are stick figures. Use cases are ovals. Communications are lines that link actors to use cases.

A use case diagram is a collection of actors, use cases, and their communications. We've put Make Appointment as part of a diagram with four actors and four use cases. Notice that a single use case can have multiple actors.

Use case diagram


Use Case Diagrams

Use case diagrams give an outsider's view of a system. Every use case diagram has actors, use cases, and communications. A simple use case diagram can be expanded with additional features to display more information.

In the use case diagram you represent the subject of the use case modeled by a box labeled with the name of the subject. You show actors outside the subject and use cases, which constitute the system behavior. Actors and use cases are in relationships that define the structure of a use case model.

The following use case diagram expands use cases defined in the original medical clinic above.

Use case diagram

Asystem boundaryrectangle separates the clinic system from the external actors.

A use case generalization shows that one use case is simply a special kind of another. Pay Bill is a parent use case and Bill Insurance is the child. A child can be substituted for its parent whenever necessary. Generalization appears as a line with a triangular arrow head toward the parent use case.

Includerelationships factor use cases into additional ones. Includes are especially helpful when the same use case can be factored out of two different use cases. Both Make Appointment and Request Medication include Check Patient Record as a subtask. In the diagram, include notation is a dotted line beginning at base use case ending with an arrows pointing to the include use case. The dotted line is labeled <<include>>.

An extend relationship indicates that one use case is a variation of another. Extend notation is a dotted line, labeled<<extend>>, and with an arrow toward the base case. The extension point, which determines when the extended case is appropriate, is written inside the base case.

Use case diagrams are helpful in three areas.

Self test


Use Case Descriptions


Use Case Description Template



Sample of Use Case Description (Microsoft Word Sample)

USE CASE 5 Buy Goods
Goal in Context Buyer issues request directly to our company, expects goods shipped and to be billed.
Scope & Level Company, Summary
Preconditions We know Buyer, their address, etc.
Success End Condition Buyer has goods, we have money for the goods.
Failed End Condition We have not sent the goods, Buyer has not spent the money.
Primary,

Secondary Actors

Buyer, any agent (or computer) acting for the customer.

Credit card company, bank, shipping service

Trigger purchase request comes in.
DESCRIPTION Step Action
  1 Buyer calls in with a purchase request
  2 Company captures buyer’s name, address, requested goods, etc.
  3 Company gives buyer information on goods, prices, delivery dates, etc.
  4 Buyer signs for order.
  5 Company creates order, ships order to buyer.
  6 Company ships invoice to buyer.
  7 Buyers pays invoice.
EXTENSIONS Step Branching Action
  3a Company is out of one of the ordered items:
3a1. Renegotiate order.
  4a Buyer pays directly with credit card:
4a1. Take payment by credit card (use case 44)
  7a Buyer returns goods:
7a. Handle returned goods (use case 105)
SUB-VARIATIONS   Branching Action
  1 Buyer may use phone in, fax in, use web order form, electronic interchange
  7 Buyer may pay by cash or money order check credit card

Use Cases Drive Analysis, Design, Testing


Register for Courses - UML Use Case Diagram


Register for Courses Bulleted Outline