Top Banner
COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases I
26

COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

Dec 21, 2015

Download

Documents

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: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

COMP1007 Intro to System Requirements

Lecture 2

Use-Cases I

Page 2: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Learning Objectives

Introduce the concept of use cases Examine various styles of

specification for use cases Consider the use of generalisation. Identify some of the problems with

use cases

Page 3: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases

Developed at Ericsson by Ivar Jacobson Premise: “the most volatile part of a

system is its users’ behaviour” Conclusion: “Model systems from the

point of view of its interactions with its users”

Use cases were part of the Objectory method (OOSE) , and now in UML

Page 4: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases

A textual “description of a set of sequences or actions (that a system performs) that yields an observable result of value to a particular actor”– An Actor is a User in a role – Users need not be human, can be other

systems, devices, subsystems etc.

Page 5: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases

Represented diagrammatically. The specification need not be purely

textual – may include state charts, activity

diagrams, collaboration diagrams and sequence diagrams.

Page 6: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

The elements of a use case may surrounded by a rectangle that represents the containing systems or classifier

UpdateMedicalHistory

Doctor

PrintPrescription

Actor Use case

Doctor

Use Case Diagram

Page 7: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Actors and Use Cases Actors

“They represent everything that needs to exchange information with the system. Since the actors represent what is outside the system, we do not describe them in detail.”

Use Cases“When a user uses the system, she or he will perform a behaviourally related sequence of transactions in a dialogue with the system. We call such a special sequence a use case.”

Jacobson, p.127.

Page 8: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases & Instances

May involve several processes Represents general description of

what happens Each particular use of a use case is

a use instance and each instance may take a different route through use case.

Page 9: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases - applicability Represent the functionality of system

or classifier such as subsystem or class.

A classifer is – A mechanism that describes behavioural

and structural features. Classifiers include interfaces classes, datatypes, and components.

RUP 2000

Page 10: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases - applicability

This new definition (UML v1.3) of a Use Case gives it a wider role than

its previous “system-level” definition

Use cases can also be used to describe “business processes”– As Jacobson suggests in The

Object Advantage?

Page 11: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case Descriptions

Each Use Case has additional details entered in the data dictionary which describe it.

This includes a text description and a list of the Actors who use it.

Page 12: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case Specification

Rational Rose 2000

Page 13: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

An Example Use Case Diagram

DepositMoney Withdraw

Money

Transfer BetweenAccounts

Bank Customer

An ATM application which offers three use cases is shown.

Page 14: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Example Use Case Specification for Withdraw Money

“The Bank Customer enters her card and is asked to enter her pin number. The ATM verifies her ID with the system.

If the ID is verified, the ATM asks the Bank Customer to select an option. If the withdraw option is selected the ATM asks the Customer to enter the amount to be withdrawn from Account. The ATM requests the withdrawal amount from the banking system. The system asks the Account to validate the request and, if possible, withdraws the amount.

The system then asks the Dispenser to dispense the appropriate amount.”

Page 15: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Alternative Specification for Withdraw Money

The use case can also be shown as a step by step breakdown of action between the actor and the system

Bank Customer

1. The Bank Customerinserts her card

ATM

2. The ATM asks theCustomer to enter her pin

3. Customer enters pinnumber

4. Systems verifies her ID5. If the ID is verified, theATM asks the BankCustomer to select anoption.

Page 16: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case Formats

Context of use Scope Level: Summary, User-goal Primary Actors Stakeholders & Interests

Cockburn, Alistair, Writing Effective Use Cases

Page 17: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case Formats Precondition Minimal Guarantees Success Guarantees Trigger Main Success Scenario Extensions Technology and Data Variations List Related Information

Cockburn, Alistair, Writing Effective Use Cases

Page 18: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Class Discussion: Use Cases

MakesSaleOf_StockItem

MakesSaleOf_StockItem

CheckOutOperator

CheckOutOperator

Customer

Which is right…

and why?

Page 19: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Generalisation

‘A generalization from an actor A to an actor B indicates that an instance of A can communicate with the same kind of use case instances as an instance of B.’ - UML 1.3

For example, the Manager actor can communicate with the same use cases as the StaffMember actor

Page 20: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Generalization - Actors

Actor B

Actor A

Generalization

Multiplicity RecordSick

Manager

*1

ClockOn

ClockOff

StaffMember

*

1

*

1

*

*

1

1 *

1

Manager

Staffmember

ClockOn

ClockOff

RecordSick

1

1

*

*

*1

Page 21: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Cases - Multiplicity

The multiplicity on the previous diagram shows the multiplicity between actor instances and use case instances. – Eg. A Manager instance may communicate

with zero or more instances of the RecordSick use case

– An instance of RecordSick may be communicated from only one Manager instance

Page 22: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case-driven Development Use cases drive the whole

development process in the RUP.– The result of the requirements workflow.

– The basis of decisions regarding architecture and component identification and design.

– Source for analysis and design use case realisations (i.e. the models involved).

– The basis of test scripts and test procedures.– The foundation of what is described in the user

manuals.

Page 23: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Use Case-driven Development Using use cases involves

– Problem statement and/or domain information is mapped to Use Case specification and diagrams

– Candidate classes are extracted from Use Cases

– Collaboration diagram developed to show collaborations

– Class diagram(s) are built up.

Page 24: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Problems with Use Cases

How broad is a Use Case? How deep is a Use Case? How many Use Cases should there be in

some typical system? Can be confused with DFDs Can lead to “main” sub-programs

through misinterpretation of “control” objects

Page 25: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

Summary

Introduce the concept of use cases Examine various styles of

specification for use cases Consider the use of generalisation. Identify some of the problems with

use cases

Page 26: COMP1007 Intro to Systems Requirements © Copyright De Montfort University 2002 All Rights Reserved COMP1007 Intro to System Requirements Lecture 2 Use-Cases.

COMP1007 Intro to Systems Requirements

© Copyright De Montfort University 2002All Rights Reserved

References Maciaszek, Requirements Analysis & Systems design,

Chp 2 Cockburn, Alistair, Writing Effective Use Cases, Addison-

Wesley, 2000 Bennett, S., McRobb, S. & Farmer, R. Object-Oriented Systems

Analysis and Design using UML McGraw-Hill 1999, (Ch 5) Jacobson, I., Booch, G. and Rumbaugh, J. (1999), The Unified

Software Development Process, Addison-Wesley, Reading Mass. (Ch 7)

Jacobson I, Christerson M, Jonsson P and Overgaard G (1992), Object-Oriented Software Engineering: A Use Case Driven Approach. (Ch 6)

Rational Unified Process 2000