Top Banner
Use Case Diagrams
63

Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Dec 28, 2015

Download

Documents

Rosanna Willis
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Use Case Diagrams

Page 2: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Use cases modeling Overview

Motivation Communication between developers and users

Users don’t know system, developers don’t know users’ work Users’ requirement needs to be clearly defined agreement between user and developer is necessary.

Use case Visual model

both users and developers can easily understand

Page 3: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Use Case Modeling

system modeling from user’s perspective

A way to define functional requirements from user

Easy to understand

Normally done during system analysis step

Implementation issue is not considered

Increase the probability of making a system user really wants

Page 4: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Use Case Use case

A view to system seen from outside User’s requirements on system A set of scenario for an actor to achieve useful

works

Bank client Bank system

Withdraw

Transfer

Balance check

deposit

Page 5: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Basic Concepts

Actor An external person, process or thing interacting with a system,

subsystem, or class User Case

Each describes a possible kind of interaction between an actor and the system

Use cases are actions that a user takes on a system System

The entity that we are going to build Can have subsystems in it

Relationship Connection between actors and use cases or use cases and use cases. The first represents communication, the second represents higher level

relationship

Page 6: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Actors

a user of the system Can be a person or another system Identify the actors in terms of their roles – not

their names Actor is shown with a stick figure

Page 7: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Use Case Use cases are actions users take on the system can be very high level or so fine-grained that they

cannot contain any other functionality Use “verb” or “verb+noun” style naming Notation

Characteristics Describes how a system can be used by an actor Represents services provided by a system User requirements

borrow return

Page 8: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

System

System refers to the module that performs the function

Use case diagram could show a part of the system, referred to as a subsystem

System or the sybsystem is shown as a rectangle enclosing the use cases, with the system name in the rectangle

Library System

Page 9: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Relationship (Use Case Diagram)

There are four kinds of relationships Association Extend Include generalization

Page 10: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Association Relationship

Shown by a line connecting actors to use cases An Actor can relate to many use cases and a use

case can relate to many actors

Page 11: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Include Relationship

Between a use case and another use case use case A includes the functionality of use case

B (has-a relationship)A B<<include>>

Page 12: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Extend Relationship

Use case can be extended by another use case At the extension point, use case is extended Extension point

Shows the exact extension point between the two use cases Shows the actual logic necessary for one use case to extend another

Page 13: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example : Extend Relationship

Page 14: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Generalization Relationship

Indicate an inheritance of an item in UML Can be applied to actors as well as use cases

Page 15: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Creating Use Case Diagrams

There are five tasks involved in creating use case diagrams

1. Identify actors of the system. Identify use cases of the system. Identify the relationships.

2. Prioritize the use cases if necessary.

3. Detail each use case. Describe Basic flow and Alternative flows for each use case

4. Identify generalizations. Identify include relationships. Identify extend relationships.

5. Create use case diagram.

Page 16: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example<Include 와 Extend 의 예 >

Page 17: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 18: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 19: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 20: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Activity Diagram

Page 21: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

What is Activity Diagram

• Shows overall flow of control (just like flowchart)

• A simplified look at what happens during a process

• Business and operational step-by-step workflows of components in a system

Page 22: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Activity Diagram Notations

Page 23: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Decision

Activity1

Activity2

Wake Up

Eat Breakfast Go Back to Sleep

[hungry] [Not hungry]

Wake Up

Eat Breakfast Go Back to Sleep

[hungry] [Not hungry]

Transition from one activity to another Two ways of showing a decision

Page 24: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Concurrent Path , Signal

Work Out

Shower Relax

Television

Show New Channel

Change (channel)

Press Channel Number

Change(channel)

Remote.keyln(channel)

Watch

Concurrent Path

Signal : when received, the signal causes an activity to take place(send : convex , receive : concave )

Synchronization bar

Page 25: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example of Activity Diagram

A Process : Creating a Document1. Open the word processing package

2. Create a file

3. Save the file under a unique name within its directory

4. Type the document

5. If graphics are necessary, open the graphics package, create the graphics, and paste the graphics into the document

6. If spreadsheet are necessary, open the spreadsheet package, create the spreadsheet, and paste the spreadsheet into the document

7. Save the file

8. Print a hard copy of the document

9. Exit the office suite

Page 26: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

활동 다이어그램

Open Word Processing Package

Create File

Save File

Type the Document

Open and Use Graphics Package

Open and Use Spreedsheet

Save File

Print Hardcopy

Exit Office Suite

[graphics needed]

[graphics not needed]

[tables needed]

[tables not needed]

Page 27: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

• show who has responsibility for each activity. (role)

1. A salesperson calls the client and sets up an appointment

2. Onsite appointment(In the consulting firm’s office)- corporate technicians prepare a conference room for a presentation

3. Offsite appointment(at the client’s office)- a consultant prepares a presentation on a laptop

4. The consultant and the salesperson meet with the client at the agreed-upon location and time

5. the salesperson follows up with a letter6. If the meeting has resulted in a statement of a problem,

thebenefit – the activities of each role are clarified

Swimlanes

9

Page 28: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Call client and set up appointment

Prepare a conferenceroom

Prepare a laptop

[appointment onsite] [appointment offsite]

Meet with the client

Send followup letter

Create proposal

Send proposal to client

See the Activity Diagramfor Creating a Document

[statement of problem]

[no statement problem]

10

AD

Page 29: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Call client and set up appointment

Prepare a conferenceroom

Prepare a laptop

[appointment onsite]

[appointment offsite]

Meet with the client

Send followup letter

Create proposal

Send proposal to client

[statement of problem]

[no statement problem]

See the Activity Diagramfor Creating a Document

Sales Person Consultant Corporate Technician

AD with Swimlane

Page 30: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 31: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

State Diagram

Page 32: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

State Diagram

Objects change their state in response to events

State Diagram presents the states an object can be transitions between the states and Starting point Endpoint

Difference from class diagram, use case diagram changes over time represents states of a single object

Page 33: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

State Diagram Components

State Icon, Transition, Starting Point, Endpoint

State Icon : State Name(Required), Activity Activity : Event and Action

entry : what happens when the system enters the state exit : what happens when the system leaves the state do : what happens while the system is in the state

Transition : Change states, arrow Occurs in response to trigger event Event and action => separated by ‘/’ triggerless transition guard condition => Boolean expression

Page 34: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Notation

state name

state variable

activity

event / action

or

[guard condition ]

Event / action

or

[guard condition]

Page 35: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Basic UML State Diagram

top

ReadyReadyReadyReady

stop

/ctr := 0stop

StateStateStateState

TriggerTriggerTriggerTrigger

ActionActionActionAction

Initial Initial pseudostatepseudostate

Initial Initial pseudostatepseudostate

TransitionTransitionTransitionTransition

Final Final statestateFinal Final statestate

DoneDoneDoneDone

““top” statetop” state““top” statetop” state

Page 36: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

PC State Diagram

Page 37: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example1 : flashing lamp

LampFlashingLampFlashingLampFlashingLampFlashing

11sec/sec/11sec/sec/

FlashOffFlashOffFlashOffFlashOff

entry/lamp.off()entry/lamp.off()

FlashOnFlashOnFlashOnFlashOn

entry/lamp.on()entry/lamp.on()offoff//

LampOffLampOffLampOffLampOff

entry/lamp.off()entry/lamp.off()

LampOnLampOnLampOnLampOn

entry/lamp.on()entry/lamp.on()

onon//

flashflash//

onon//

Default transition toDefault transition tothe initial pseudostatethe initial pseudostateDefault transition toDefault transition to

the initial pseudostatethe initial pseudostate

Group transitionGroup transitionGroup transitionGroup transition

Page 38: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example2 : dialing

Page 39: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

ex3 : login of an online banking system

Page 40: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Substates

Sequential substates

Concurrent substates

Page 41: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Activity Diagram vs State Diagram

State Diagram A clear picture of the changes in the

object’s state in a process

Activity Diagram Flow chart : flow of activity of a process

Page 42: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Sequence Diagram

Page 43: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Purpose of Sequence Diagram

to show the interactions between objects in the sequential order

shows the sequence of messages for a particular task from a use case diagram

Understand how objects in system interact with each other

Understand how use case(scenario) can be refined with detailed information

Use cases are often refined into one or more sequence diagrams

Page 44: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Sequence Diagram

Time, object, and message Lifeline and activation

:NameNotation

Page 45: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Basics

Focus on order in which messages occur

:Name1 :Name2

lifeline

activation

message

object

objectstime

Page 46: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Messages

The first message starts at the top, typically located on the left side

Subsequent messages are then added to the diagram slightly lower then the previous message

Messages can be sent to itself

: synchronous call operation : method on the arrow

: asynchronous signal

: return message (optional) : return value on the arrow

Page 47: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

An example of messages being sent between objects

The system object calling its determineAvailableReports method

Page 48: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Synchronous vs asynchronous

Page 49: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

guards

Used when a condition must be met for a message to be sent

Page 50: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Combined fragment

A combined fragment is used to group sets of messages together to show conditional flow in a sequence diagram

Alternatives Options loops

Page 51: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

alternatives

Design mutually exclusive choice between two or more message sequences

Page 52: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

option

Model a sequence that occur when a certain condition is satisfied

Page 53: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

loops

model a repetitive sequence

Page 54: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Sequence diagram example

Object

Message

Activation

Time constraint

Comment

Page 55: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 56: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Sequence Diagram : Why Useful?

shows the interaction logic between the objects in the system in the time order that the interactions take place.

Page 57: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Communication Diagram

Page 58: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Communication Diagram Class diagrams indicates what classes are part of our system,

what they offer, how they relate, but they don’t tell us how they communicate.

Communication diagrams show (used to model) how objects interact and their roles.

Similar to Sequence Diagrams. Communication Diagram := Class Diagram + Sequence diagram Sequence Diagrams are arranged according to Time. Communication Diagrams represent the structural

organization of object. Both Sequence and Communication diagrams are called

interaction diagrams

Page 59: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Communication diagram

Objects interact to perform some task

Links (messages) which show associations between objects Similar to sequence diagram arrows

Actors from the use case diagrams

Page 60: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Symbols

:Name1

:Name2

:Name3

1:Add()

2:Modify()

3:Update()

Numbering : The order of messagesex) 1,2,3 , …, 3.1 , 3.2

Page 61: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Example

Page 62: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Ex) Soda Machine : Simple Scenario

Page 63: Use Case Diagrams. Use cases modeling Overview Motivation Communication between developers and users Users don’t know system, developers don’t know users’

Ex) Soda Machine : Complex Scenario