Week 3 Lecture

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 53

Use case

A goal/task to be accomplished with the system from


an actor’s perspective

In our class:
• human actor’s initiate use case
• external system actors can participate in middle of
use case initiated by human actor
• Use case occurs in single session, e.g., request
holiday vs. approve holiday are separate use cases
Are these same or different use
cases?
request holiday; approve holiday

Different use cases, different actors, different session


Organisation’s roles may inform choice
of actors

The roles in organization give you an idea for possible actors in your use case
scenario. Whom you choose to be an actor may be a specific job title,
‘Accountant’, or can be general ‘Creative staff’.
4
Remember, external systems can be actors too.
Existing and Proposed
Systems
Existing system:
client management
• record names
• assign client contact
• campaign
staff management
• names, grades, bonuses
Redevelop existing system in Java,
more functions
5
Notes from the meeting
A record is kept of each client company and each client company has one person who is the
contact person. Contact person’s name and contact details are kept in the client record.
Agate nominates a member of staff to be the contact for each client.Clients have
advertising campaigns and a record is kept of every campaign.
One member of Agate’s staff manages each campaign. Staff may be working on more than
one project at a time. For each project they work on, they are answerable to the manager
of that project. When a campaign starts:
When a campaign starts, the manager estimates the likely cost agreed with by client.
Campaign’s finish date may be set at any time,and may be changed.
When the client pays, the payment date is recorded.
Each campaign includes one or more adverts. There are several types of adverts: Newspaper
adverts, Magazine adverts, Internet adverts, TV adverts, Radio Adverts
Puchasing assistants are responsible for buying space in newspapers and magazines and so
on.
The actual cost of a campaign is calculated from a range of information such as the costs of
staff time, studio time and actors, copyright material, space in newspapers

© 2010 Bennett, McRobb


Summary of Functional Requirements
To record names, address and contact details for
each client.
To record the details of each client including the title
of the campaign, planned start and finish start
dates...
To record payments for campaign
To record which staff is assigned to which client
To record which staff are working on which
campaigns, including managers.
To schedule the dates when adverts will be run.
To calculate the annual bonus for all staff.
© 2010 Bennett, McRobb
Summary of Functional Requirements?
Non-functional requirments
To enable data about clients, campaigns,
adverts and staff to be shared between
offices.
To allow the system to be modified to work
in different languages.
Notation of Use Case Diagrams
Use cases
Add a new
client

drawn as ellipses with a name inside


describe sequence of actions that the system
performs to achieve an observable result of value to
an actor
the name is usually an active verb and a noun phrase
‘user’ language, not computer-speak (not ‘input-box’,
‘click’ etc., use ‘add’ instead)
10
Existing and Proposed
Systems
Existing system: Add a new
client
client management
• record names ?
• assign client contact
• campaign
?
staff management
• names, grades, bonuses
Redevelop existing system in Java,
more functions
11
Existing and Proposed
Systems
Existing system: Add a new
client
client management
• record names Assign staff to work
• assign client contact on campaign

• campaign
staff management
• names, grades, bonuses
Redevelop existing system in Java,
more functions
12
Existing and Proposed
Systems
Existing system: Add a new
client
client management
• record names Assign staff to work
• assign client contact on campaign

• campaign
Add a new
staff management campaign
• names, grades, bonuses
Redevelop existing system in Java,
more functions
13
Notation of Use Case Diagrams
Communication associations

Add a new
client
Add a new
campaign
Campaign Assign staff to work
Manager on campaign

line drawn between an actor and a use case


represent communication link between an instance of the
use case and an instance of the actor

14
Notation of Use Case Diagrams
Subsystems (also called subjects)
drawn as a rectangle around a group of use cases
that belong to the same subject
in a CASE tool, use cases for different subjects are
usually placed in separate use case diagrams

Add a new
client
Add a new
campaign
Campaign Assign staff to work
Manager on campaign

15
Use case diagrams
for Agate Add a new
client
Add a new
campaign
Assign staff to work
Campaign on campaign
Manager Add a new advert
to a campaign
Record completion
of a campaign

Assign a staff
contact
Change a
client contact

Staff Contact Record completion


of an advert

16
Additional descriptions/notations
Each use case (ellipse) and actor (stick figure) is
usually accompanied by a textual actor and use
case description. This can be brief description, or
can be a step-by-step breakdown of the interaction
between the actor and system

These descriptions are added using the program


you are using to draw UML diagrams

17
Use Case Diagrams will often be accompanied
by more detailed descriptions of actor and use
case
Add new
advert to
campaign
Campaign
Manager

So for above Use Case, additional screens in CASE tool will


show the following descriptions:

Campaign Manager Add new advert to campaign

Detailed description… Detailed description…


……………… ………………

18
Actor Description Add new
advert to
campaign
Campaign
Manager

Campaign Manager
A Campaign manager is either a Director or an
Account Manager. They are responsible for
estimating the campaign cost and agreeing it with
the client. They are responsible for assigning staff
to the team and supervising their work, managing
the progress of the campaign, conducting any
further budget negotiations, and authorizing the
final invoice.
19
Agate Use Cases and Descriptions
Add a new A campaign can consist of many adverts. Details of
advert to a each advert are entered into the system, including
campaign advert cost
Record When a campaign is completed, the actual
completion of completion date and cost are entered. A record of
a campaign completion form is printed out for the Accountant as
the basis for invoicing the client
Assign a Clients have a member of staff assigned to them
staff contact as their particular contact person.
Change a Records when the client’ s contact person with
client Agate is changed.
contact

20
Agate Use Cases
Record When an advert is completed, the actual date is
completion entered.
of an advert
Add a new When Agate obtains a new client, the full details of
client the client are entered. Typically this will be because
of a new campaign, and therefore the new
campaign will be added straight away.
Add a new When Agate gets the business for a new campaign,
campaign details of the campaign are entered, including the
intended finish date and the estimated cost. The
manager for that campaign is the person who
enters it.
Assign staff to When a new campaign starts, members of staff are
work on a assigned to work on it.
campaign
21
Add a new
member of staff

Add a new staff


grade

Change the rate for


a staff grade
Accountant

Change the grade


for a member of staff

Record client
payment

22
Accountant Use Case descriptions
Add a new member of staff
When a new member of staff joins Agate, his or her details are
recorded. He or she is assigned a staff number, and the start date is
entered. Start date defaults to today’ s date. The starting grade is
entered.

23
Accountant Use Case descriptions
Add a new staff grade

Change the rate for a staff grade

Change the grade for member of staff

Record client payment

24
Accountant Use Case descriptions
Add a new staff grade
Occasionally a new grade for a member of staff must be added. The
name of the grade is entered. At the same time, the rate for that
grade and the rate start date are entered; the date defaults to today’
s date.

Change the rate for a staff grade


Annually the rates for grades are changed. The new rate for each
grade is entered, and the rate start date set (no default). The old
grade is retrieved and the rate finish date for that grade rate set to
the day before the start of the new rate.

25
Accountant Use Cases

Change the grade for a member of staff


When a member of staff is promoted, the new grade and the
date on which they start on that grade are entered. The old
staff grade is retrieved and the finish date set to the day before
the start of the new one.

Record client payment.


When a client pays for a campaign, the payment amount is
checked against the actual cost and the date paid is entered.

26
Good Use Cases
Identifying use cases
do not distinguish too many, especially at
first
Title
verb and noun combination
Language
‘user’ language, not computer-speak
avoid ‘click’, ‘input’, ‘menu box’
27
Use Case Diagram for Agate System

Note: Accountancy Use Cases and Creative Staff Use Cases are shown in different boxes because the
separate boxes denote different sub-systems of the overall system.
Detailed Description of a
Use Case
• add more detail
• describes what the system should do: inputs and
outputs, i.e., what the actor sees happening
• Does NOT describe coding, data storage structures
• following a template,
• Unlike Use Case diagram, no universal template

29
Suggested Detailed Use Case
Description Template
Use case name
Description
Precondition: required starting state of system
(optional)
Normal flow of events (actions and system
responses)
Alternative flows (optional)
Postcondition: ending state of system (optional)
Exceptions (optional)
30
Suggested Detailed Use Case
Description Template
Use case name
Description

31
Suggested Detailed Use Case
Description Template
Use case name Add new advert to campaign
Description
A campaign can consist of many adverts. Details of
each advert are entered into the system, including
advert cost

32
Suggested Detailed Use Case
Description Template
Use case name Add new advert to campaign
Description
A campaign can consist of many adverts. Details of
each advert are entered into the system, including
advert cost

Normal Flow:

33
Add new
Use cases get more detailed as advert to
analysis progresses campaign
Campaign
Manager
less detail

A campaign can consist of many adverts.


Details of each advert are entered into the
system, including advert cost More
Detail
Add new
Use cases get more detailed as advert to
analysis progresses campaign
Campaign
Manager
less detail

A campaign can consist of many adverts.


Details of each advert are entered into the
system, including advert cost More
more detail Detail
A campaign can consist of many adverts.
Details of each advert are entered into the
system, including advert cost. If the costs of
new advert exceed the campaign’s budget, do
not add advert but generate a warning email
requiring budget increase approval instead
Detailed Use Case Description: Normal
Flow
-also called ‘normal path’, ‘primary flow’ etc.
-steps through most frequent scenario or
scenarios of the use case
-distinguish between the actor request vs.
system’s response
request
actor response system
Normal Flow shows Add new
advert to
Alternation between actor Campaign
campaign

and system Manager

Use case description: Add a New Advert to a Campaign

Actor Action System Response

1. Campaign manager indicates 2. Displays campaign budget, total


they want to add advert to cost of adverts paid for and total
campaign estimated cost of adverts not paid
for.
3. Campaign manager enters
4. Creates new advert and adds to list
details of advert including
of adverts for that campaign.
estimated cost.

37
Detailed Use Case Description:
Alternative Flow
Variation to some steps of the normal flow
Alternative flow allows several related
scenarios to be combined
• Admin. enters the • Admin updates the
student details student details

Single use case: admin enters/updates


student details
38
Detailed use cases shows Add new
advert to
Alternation between actor Campaign
campaign

and system Manager

Use case description: Add a New Advert to a Campaign

Actor Action System Response


1. Campaign manager indicates 2. Displays campaign budget, total
they want to add advert to cost of adverts paid for and total
campaign estimated cost of adverts not paid
for.
3. Campaign manager enters
details of advert including 4. Creates new advert and adds to list
estimated cost. of adverts for that campaign.

Alternative Flow: At step 4: Advert exceeds budget


4.1 System displays the advert will exceed the budget and a budget
extension request is generated.
39
Add new
Detailed Use Case Description for Agate advert to
Use Case campaign
Campaign
Name: Add a New Advert to a Campaign Manager
Normal Flow
1. Campaign manager indicates they want to add advert
2. System displays campaign budget, total cost of adverts paid for and total
estimated cost of adverts not paid for.
3. Campaign manager enters details of advert including estimated cost.
4. System checks campaign is within budget. If so, it creates new advert
and adds to list of adverts for that campaign Also can say ‘After Step 3’
Postcondition: Advert is now part of campaign
Alternate Flow: At step 4: Advert exceeds budget
4.1 System displays the advert will exceed the budget and a budget
extension request is generated.
Can be unclear which is normal vs. alternative
Sometimes alternative flows will be better as own use cases
40
Detailed Use Case: Exception Flow

‘error’ like situations where we want system to


respond to user, e.g., ‘wrong password’
Exceptions v. Alternatives
• exception indicates something abnormal happened
(missing/wrong information)
• alternative is intentional choice by user, just different
to the normal flow interaction
• exception flow is an ‘unintended path’
• less common than alternative flows

41
Additional descriptions for use
cases: Pre- and Postconditions
-Precondition
must be true for use case to be possible
-Postcondition
how the system is changed by the interaction
e.g. ‘customer order is recorded’
may be slight repeat of last line of flow
Each alternative/exception flow may have
own postcondition

42
-Additional Use Case notations:
-include
-extend

-Actor generalisation

© 2010 Bennett, McRobb and Farmer 43


Notation of Use Case Diagrams
Dependencies
• Extend and Include relationships between use
cases
shown as stereotyped dependencies
stereotypes are written as text strings in
guillemets: «extend» and «include»

44
Use case: Assign staff to work on campaign
1. Campaign manager indicates wanting to assign staff to campaign
2. System shows a list of clients
3. Campaign manager chooses relevant client
4. System shows list of campaigns for that client
5. Campaign manager choose relevant campaign
6. System shows list of staff
7. Campaign manager choose staff to work on campaign Same steps:
8. System records staff as working on campaign “Find
Use case: Add advert to campaign (expanded from last week) Campaign”
1. Campaign manager indicates they want to add advert
2. System shows a list of clients
3. Campaign manager chooses relevant client
4. System shows list of campaigns for that client
5. Campaign manager choose relevant campaign
6. System displays campaign budget, costs of adverts paid for and not paid
for
7. Campaign manager enters details of advert including estimated cost.
8. System checks campaign is within budget. If so, it creates new advert and
«include»

Assign staff to
Work on a Campaign «includes»

Find Campaign

Campaign Add a New Advert «includes»


Manager to a Campaign

46
Detailing «include»
Use case: Update widget details • Informal approach – not
too much ‘apparatus’
Description: Update the details about
the widget
Normal flow:
Use case: Find Widget Details
1. Widget details are displayed with
‘Find Widget Details’
Description: Display the basic details
2. User enters new widget price
about the widget
3. …..
Normal flow:
1. User requests list of widgets
2. System displays the available widgets
3. User chooses the widget identifier
Possible template for 4. System displays widget details
included use case
47
«extend»
Basic Use Case
Extension Point

«extend» «extend»

Extension A Extension B

One use can extend the functionality of


another
Extension may be available to another actor

48
Detailing «extend»
Use case: Display details
• Informal approach – not
Description: Display the basic details
too much ‘apparatus’
Normal flow:
1. User enters widget name
2. System displays the details Use case: Confidential display

Extension points: Description: Display the basic details


When the system displays details
(step 2): Normal flow:
Print details Extends ‘Display details’
Confidential display 1. User enters authorisation code
2. System displays confidential data
Possible template for
extended use case
49
«extends»

Check Campaign Budget


System Displays Balance

«extends» «extends»
Campaign Accountant
Manager
Print Campaign Print Campaign
Summary Invoice

50
Actor Generalisation
Some actors
represent roles which
generalise another
Staff Member
role
Use cases available to
the ‘Staff Member’ are
also available to the
‘Campaign Manager’
Campaign Staff Contact
Manager
51
What is vs. is not a use case for
QMPLUS?
• help student No too vague
• enter password No too detailed
• create username No too detailed
• upload coursework Yes
• create quiz Yes
• write code for system No, use cases are actor
interactions, not building
system
No, this is part of ‘attempt
• save quiz
quiz’

You might also like