25
1 Overview of Use Cases & Examples

Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

1

Overview of Use Cases&

Examples

Page 2: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

2

• A use case is a way in which a user can use a system, i.e., perform some function on a system.

• A use case describes a goal a user may want to do with the system and the sequence of steps a user does in the system to accomplish the goal, and also, the corresponding system response to each of the user’s actions.

• A user of the system is called an actor, because it performs some kind of action on the system. An actor can be a person or thing (software or hardware).

• Use cases describe the functionality of a system, i.e., what the system does. And from this point of view, use cases specify requirements of a system.

• A complete set of use cases represents all of the system’s functionality from the point of view of an actor.

Page 3: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

3

Ways of Describing Use Cases• Two ways:

• Text Description

• Diagram Description

Page 4: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

4

• Title (goal)• Describe the overall goal of the use case

• Actors• Identify the actors for the use case. • A given use case may pertain to a smaller subset of

actors or to all actors.

• Interaction• A sequential, numbered, and point form list of

interactions between actor and system.

Page 5: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

5

• Three main components• Actor

• Stick person• Use Case

• Oval, with text description inside• Description starts with a verb.

• Association• Line joining the actor and the use case

Actor

Description of use case

Use Case Association

User

Use Case Description

Diagrammatic Description

Page 6: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

6

A use case describes what a user does to perform a particular task that the system offers, and also, it describe the system’s visible response.

Step 1: list all the actors. Actors are the users and/or other systems that will use the system.

Step 2: determine the tasks that each actor will need to do with the system. Each task is called a use-case because it represents a particular use of the system.

Step 3: For each use case, develop a description (in words) and/or diagram. In it, specify the Goal, actors, and sequence of steps

Page 7: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

7

Example: Temperature Server• Consider an MX7cK board which senses temperature at 25 points in a sensing grid.

• Consider designing a user interface (UI) on a PC connected to the system through a network.

• What functionality should the UI present to the user?

25 Sensor Temperature Sensing Grid

Sensor

25

Network

PC (UI)

User

Page 8: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

8

• Ordinary user• Any user who wants to use the temperature sensing system.

• Administrative user• May be required to do administrative tasks, which should not be

done by an ordinary user, such as• Perform tests on the sensors to determine correct

functionality.• Calibrate temperature for the sensors.• Set the temperature sampling period, i.e., the time between

samples• Shutdown and restart the server for maintenance, etc.

Page 9: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

9

Step 2: List Use CasesThese Become Requirements

• Set IP address and/or port of server– There could be many different temperature servers on the

Internet of Things, each of which control their own grid of sensors

• Connect to server

• Disconnect from server

• Get temperature readings

• Calibrate temperature sensors

• Others?

Page 10: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

10

• Set ID of the server• The goal is to allow a user to specify the ID of the server

• This may be done by specifying the IP address and port number of the server.

• Actors• Any user, i.e., ordinary user or administrative user, may perform this use case.

• Interaction

1. Actor enters an IP address and port number of the server.

ACTOR2. System acknowledges and displays

back the entered IP address and port number of the server.

SYSTEM

Page 11: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

11

Use Case 2: Get Temp. Readings• Get temperature readings

• The goal is to allow a user to obtain temperature sensor readings, but also which sensors to obtain.

• Actors• Any user, i.e., ordinary user or administrative user, may perform this use case.

• Interaction

2. System displays the temperature readings of the requested sensors.

3. System also displays the time stamp of when the readings were taken.

1. Actor specifies the combination of temperature sensor readings to get.

ACTOR SYSTEM

Page 12: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

12

• Describe other use cases, if any.

Page 13: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

13

“Set Server ID” Use Case DiagramFor Ordinary User

User

Set IP and port of server

Page 14: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

14

“Set Server ID” Use Case DiagramFor Administrator Users

Administrative User

Set IP and port of server

Page 15: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

15

“Set Server ID” Use Case DiagramFor Both Users

• Note: this is redundant, especially if there are many actors with the same use case.

• A better way to show this is through “Actor Generalization.”

Administrative User

Set IP and port of server

User

Set IP and port of server

Page 16: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

16

Actor Generalization RelationshipUseful in Defining Overlapping Roles Between Actors

User

An actor is represented by a ‘stick person’, even if the actor is not a human being (could be software or hardware, or another system).

Customer Administrator

A general name of the actor is written down underneath the stick person figure.

The generalization relationship between actors (if one exists) is represented by connecting the actors with lines, with the closed triangle pointing to the super actor.

Page 17: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

17

“Set Server ID” Use Case DiagramBetter Way

• The Administrator inherits the use case of the Ordinary user.

Ordinary

Set IP and port of server

Administrative

Page 18: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

18

Used to handle exceptional or special cases.

For example, for the use-case called:

“Set Server ID”

– The user may enter an IP address which is incorrectly specified (i.e., not in 4 octet dot format)

• For example, an actor may enter “192.16.1”

An extension allows keeping the description of thebasic use case simple.

Page 19: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

19

Set Server Id Extension Use CaseText Description

• Set ID of the server• The goal is to allow a user to specify the IP address & port number of the server.

• Actors• Any user, i.e., ordinary user or administrative user, may perform this use case.

• Interaction

2. If IP address and port number correct, System acknowledges and displays the requested IP address and port number of the server.

3. Else, the system displays a message that indicates which part (IP and/or port number) is incorrect and why.

1. Actor enters an IP address and port number of the server.

ACTOR SYSTEM

Page 20: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

20

“Set Server ID” Use Case DiagramWith Extension

OD User

Set Server ID

Administrator

<<extend>>

Specify ID incorrectly

Page 21: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

21

Used to express commonality between two or more differentuse cases.

Two or more uses cases may share a component behaviour. Even very different use cases can share sequence of actions.

Instead of repeating the component behaviour, the uses casesthat can share the common component.

For example, the “Get temperature readings” and “Calibratetemperature sensors” would share a component “specifysensors.”

Page 22: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

22

With Inclusion (And Administrator Specialization)

OD User

Get temperature readings

Administrator

<<include>>

Specify sensors

Calibrate temperature sensors

<<include>>

Page 23: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

23

Summary: Use-case Relationships(Three Relationships)

Generalization Actor and Use Case

Extension There can be many variations (scenarios) of the basic use case

Inclusion Two or more use cases may have some common sub components

Page 24: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

24

Use Case Diagram for Temp SystemAll Use Cases Developed So Far

OD User Set Server ID

Administrator

<<extend>>Specify ID incorrectly

Get temperaturereadings

<<include>>

Specify sensors

Calibratetemperature

sensors

<<include>>

Set IP and port of server

Page 25: Overview of Use Cases Examplesece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides/L30UMLUseCase... · 2 • A use case is a way in which a user can use a system, i.e., perform

25

• Help to define the scope of the system

• Used to plan the development process– Allocation of uses cases to sub groups of developers– Hardware/software components breakdown

• Used to develop and define the requirements

• Used to generate requirements verification test cases for TPP

• Used to structure user manuals