3. use cases

31
Slide 1 Object-Oriented Software Systems Engineering – Chapter 3 Use Cases Chapter 3

Upload: apu

Post on 08-Dec-2014

3.073 views

Category:

Documents


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 3. use cases

Slide 1Object-Oriented Software Systems Engineering – Chapter 3

Use Cases

Chapter 3

Page 2: 3. use cases

Slide 2Object-Oriented Software Systems Engineering – Chapter 3

Objectives

In this chapter we will: Describe use case modelling Introduce use cases and actors Discuss relationships between use cases Introduce use case descriptions

Page 3: 3. use cases

Slide 3Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling

The purpose of use case modellingto decide and describe the functional

requirements of the systemto give clear and consistent description of what

the system should doto provide a basis for performing tests that

verify the systemto provide the ability to trace functional

requirements into classes and operations

Use case model represents use-case view is described by a use-case diagram

Page 4: 3. use cases

Slide 4Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling

Use Cases are described using both text documents and diagrams

Use-case modelling is primarily an act

of writing text NOT just drawing diagrams

Page 5: 3. use cases

Slide 5Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling

Definition of use caserepresents a complete functionality as perceived by an actora set of sequences of actions a system performs that yield

an observable result of value to a particular actor

Characteristicsis always initiated by an actorprovides tangible value to an actor (observable not

necessary salient)is complete - use case is not complete until an end value is

produced even if several communications occur along the way

Scenario’s are instances of use-casesA specific sequence of actions that illustrate behaviourYou’ll find primary scenarios and secondary scenarios

Page 6: 3. use cases

Slide 6Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – terms & concepts

Name of System

A Use CaseAn Actor

Page 7: 3. use cases

Slide 7Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – terms & concepts

The system boundary defines responsibilityblack box that provides use-caseswithin the system boundary

what the system does but not how the system does Use-cases

a description of a set of sequence of actions, including variants that the system performs to yield an observable value to an actor

a set of scenarios

Page 8: 3. use cases

Slide 8Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – terms & concepts

Actorrepresenting a role that someone might play, rather than

a particular individualexternal entity that has interest in interacting with the

system

Interactiona communication relation between an actor and a use

case

Page 9: 3. use cases

Slide 9Object-Oriented Software Systems Engineering – Chapter 3

Identifying Use Cases and Actors

What functions does the actor require from the system?

Does the actor need to read, create, destroy, modify or store some kind of data in the system?

Does the actor have to be notified about events in the system, or does the actor need to confirm with the system for something?

Could the actor’s daily work be simplified or made more efficient via new functions in the system?

What input/output does the system need? Can these requirements be handled by one actor

or someone else as well?

Page 10: 3. use cases

Slide 10Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – organising use cases

UML use-case diagram

Communication associations:connect actors to use cases

Manager

UseCase 1

User 2UseCase 3

User 1

UseCase 2

An Actor A Use Case

Communication Association

Page 11: 3. use cases

Slide 11Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – types of relationships

Relationships between actors

generalization - specialization

Library User

Student Lecturer

Page 12: 3. use cases

Slide 12Object-Oriented Software Systems Engineering – Chapter 3

Use Case Modelling – types of relationships

Two stereotypes of dependency relationship in use cases

<<include>>

BA

Include specifies that the source use case

(A) explicitly incorporates the behaviour of the target (B)

A includes the behaviour of B

Extends specifies that the target use case

(B) extends the behaviour of the source (A)

A is extended from B by adding

some actions

<<extends>>

BA

Extension points

Page 13: 3. use cases

Slide 13Object-Oriented Software Systems Engineering – Chapter 3

Use Case Relationships

Extend and Uses relationship - different forms of re-use Extend relationship - accounts for optional behaviour Include relationship -uses or include relationship

one use case uses another use case (reuse by composition)

Place orderExtension pointsset priority Vaildate user

Place rushorder

<<extends>>(set priority)

<<uses>>Check password

Retinal scan

Page 14: 3. use cases

Slide 14Object-Oriented Software Systems Engineering – Chapter 3

A Simple Use Case Diagram of Librarypart 1

Library Member

Search for book

Borrow a copy of book LibrarianRefuse

loan

Member of Staff

Return a copy of book

Reserve a book

Library System

<<extend>> over limit

Update catalog

Extend loan

<<include>>

<<include>>

Page 15: 3. use cases

Slide 15Object-Oriented Software Systems Engineering – Chapter 3

Use Case Diagram - order processing

Return product

Update product quantities

Place order extension points

set discount

<<extend>>

Give product information

Update account

Customer discount

<<include>><<include>>Cancel order

Get status on order

Run sales report

Customer

Sales Rep

Inventory system

Accounting system

<<include>>

<<include>>

<<include>>

<<include>>

Page 16: 3. use cases

Slide 16Object-Oriented Software Systems Engineering – Chapter 3

Use Case Diagram - course management

Student

Register for courses

Billing system Create course

catalogue

Lecturer

Select courses to

teach

Registrar

Request course roster

Maintain information

Maintain course’s infor.

Maintain lecturer’s infor.

Maintain student’s infor

Course Management System

Page 17: 3. use cases

Slide 17Object-Oriented Software Systems Engineering – Chapter 3

Manager

UseCase 1

Actor 2 UseCase 3

Actor 1

UseCase 2

Use Case diagram

Class 1Class 2

Class 3 Class 4

c3: objectc2: object <<Actor>>

User

0: event

1: operation 2: operation

Class diagram

Sequence diagram state 2

state 1

State diagram

Page 18: 3. use cases

Slide 18Object-Oriented Software Systems Engineering – Chapter 3

Manager

UseCase 1

Actor 2 UseCase 3

Actor 1

UseCase 2Use Case diagram

Class 1Class 2

Class 3 Class 4

c3: objectc2: object <<Actor>>

User

0: event

1: operation 2: operation

Class diagram

Sequence diagram state 2

state 1

State diagram

state 2

state 1

State diagram

Page 19: 3. use cases

Slide 19Object-Oriented Software Systems Engineering – Chapter 3

Use Case

A use case is a starting point You may not know very much about a subject,

write down what you do know Then you need to find out the detail that you do

not know but that you need to know in order to solve the problem

When we have as much detail as we need, we can produce Use Case Descriptions

Page 20: 3. use cases

Slide 20Object-Oriented Software Systems Engineering – Chapter 3

Use Case Descriptions

A use case description: The text to describe a particular use case

interaction - in the form of a 2-way dialogue between the actor and the system

Provides the supporting detail for the use case diagram - not to be started until the diagram is complete/nearly complete

Also known as Use Case Scripts or Use Case Scenarios (beware - the latter has another meaning)

Page 21: 3. use cases

Slide 21Object-Oriented Software Systems Engineering – Chapter 3

What to describe

Describe the most common/normal form of interaction first - the basic course

Describe possible variations separately - the alternative courses

The script should be in a conversational style:actor requests….System responds by….Actor does…..And so on..

Page 22: 3. use cases

Slide 22Object-Oriented Software Systems Engineering – Chapter 3

Example of a Use Case Description

In the video rental shop, the interaction between Counter Assistant and Rent Video use case may be:

Actor Actions System Response1. Customer tenders video(s) to be

rented and membership card

2. Counter assistant enters member 3. System provides member details and

no.into system status of loans and fines

4. Assistant enters identification of each

video to be rented 5. System accepts ids and gives fee payable

6. Assistant requests payment, takes

money and enters payment made 7. System logs payment details

Page 23: 3. use cases

Slide 23Object-Oriented Software Systems Engineering – Chapter 3

Guidelines

Include a series of numbered sections or steps which describe noteworthy events and possibly related context, constraints and business rules

Steps may alternate between actor and system, or may be a series of consecutive steps taken by either of them

Written from the user’s point of view Written in the vocabulary of the user

Page 24: 3. use cases

Slide 24Object-Oriented Software Systems Engineering – Chapter 3

Conversational Style

This conversational style script (as if for a theatre play) is a good compromise between the advantages and disadvantages of other methods:

It is quick and easy to write (important for capturing early, outline information)

It is quick and easy to read and to understand It encourages concise-ness It identifies the required sequence of actions It highlights causes and effects

Page 25: 3. use cases

Slide 25Object-Oriented Software Systems Engineering – Chapter 3

Essential Use Cases

These are used during the feasibility and analysis stages of the project

The aim is to be free of implementation detail to show the essence of the business requirements (the conceptual model)

Enables analysts, developers, users and clients to understand the scope of the problem and the processes required

Page 26: 3. use cases

Slide 26Object-Oriented Software Systems Engineering – Chapter 3

Real Use Cases

Now the Essential Use Cases will be used as the basis for lateral, creative thinking with the opportunity for new ideas on how to create the system

Real Use Cases are used to document the design of the project

how it will work in reality

For a user interface it may include prototype screen shots, print layouts, form layouts, menus

For a system interface it may include file layouts

Page 27: 3. use cases

Slide 27Object-Oriented Software Systems Engineering – Chapter 3

Template Sections

The following sections are normally included:

Use Case - its identifier/name Actors - list of actors involved. Show which one

initiates the use case Overview - short outline description summarising

the use case Type - category of the use case Cross References - use case relationships

(covered later)

Page 28: 3. use cases

Slide 28Object-Oriented Software Systems Engineering – Chapter 3

Categories of Use Cases

1. Primary - major common process For example: Rent Video

2. Secondary - minor or rare processes For example: Request to supply unstocked New Video

3. Optional - processes that may or may not be used

Page 29: 3. use cases

Slide 29Object-Oriented Software Systems Engineering – Chapter 3

Alternative Courses

Alternative courses can describe alternative events to the typical story

These are the less common, the exceptional or error cases

Place all the alternatives after all the typical course of events

For example:7. Customer pays clerk by cash or credit

Alternative Courses

7. Customer has unpaid late charges and will not pay them. Collect payment or cancel rental transaction

Page 30: 3. use cases

Slide 30Object-Oriented Software Systems Engineering – Chapter 3

Use Case Descriptions

Review of use case descriptions:

Use Case descriptions supply the detail of system requirements

Conversational scripts are used to describe the interactions between actors and use cases

The basic course may be followed by 1 or more alternative courses

Essential Use Cases are used during Analysis, Real Use Cases are used during Design

Page 31: 3. use cases

Slide 31Object-Oriented Software Systems Engineering – Chapter 3

Summary

In this chapter we have: Described use case modelling Introduced use cases and actors Discussed relationships between use cases Introduced use case descriptions