unit 3 functional requirements. syllabus introduction features and usecases use case scenarios...

30
Unit 3 Functional Requirements

Upload: hugh-harris

Post on 17-Jan-2016

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Unit 3

Functional Requirements

Page 2: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Syllabus

• Introduction• Features and usecases• Use case Scenarios• Documenting use cases• Levels of details• SRS Document

Page 3: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

CMSC 345, Version 9/07S. Mitchell

Use Cases

Concepts, Specifications, and Diagrams

Page 4: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

4 CMSC 345, Version 9/07S. Mitchell

Introduction

• “Invented” by Ivar Jacobson in the late 1960’s (where have we seen his name before?)

• Introduced to the OO community in the late 1980’s• Alistair Cockburn has extended Jacobson’s model• Is a way to specify functional requirements• Is notated using a use case specification• Is not part of the Unified Modeling Language (UML),

but is many times used in conjunction with it

Page 5: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

5 CMSC 345, Version 9/07S. Mitchell

What is a Use Case? (Cockburn)• A use case captures a contract between the stakeholders of a

system about its behavior.

• Describes the system’s behavior under various conditions as the system responds to a request from one of the stakeholders called the primary actor.

1. The primary actor initiates some interaction with the system to accomplish some goal.

2. The system responds, protecting the interests of all of the stakeholders.

3. Different sequences of behaviors, or scenarios, can unfold, depending on the requests and the conditions surrounding the request. The use case gathers these scenarios together.

Page 6: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

6 CMSC 345, Version 9/07S. Mitchell

Use Case Specification: Natural Language Example

Use Case 1. Withdraw Money

The system displays the account types available to be withdrawn from and the user indicates the desired type. The system asks for the amount to be withdrawn and the user specifies it. Next, the system debits the user’s account and dispenses the money. The user removes the money, the system prints a receipt, and the user removes the receipt. Then the system displays a closing message and dispenses the user’s ATM card. After the user removes his card, the system displays the welcome message.

Page 7: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

7 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions

Postconditions

Primary Actor(s)

Secondary Actor(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Page 8: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

8 CMSC 345, Version 9/07S. Mitchell

Number Unique use case number

Name Brief verb-noun phrase

Summary Brief summary of use case major actions

Priority 1-5 (1 = lowest priority, 5 = highest priority)

Preconditions

Postconditions

Primary Actor(s)

Secondary Actor(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Page 9: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

9 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions What needs to be true before the use case “executes”

Postconditions What will be true after the use case successfully “executes”

Primary Actor(s)

Secondary Actor(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Precondition: y != 0

Postcondition: x / y

double divide(double x, double y) {

return (x / y);

}

Precondition: None

Postcondition: if y==0 “Illegal”, else x / y

double divide(double x, double y) {

if (y == 0) cout << “Illegal\n”;

else return (x / y);

}

Page 10: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

10 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions

Postconditions

Primary Actor(s) Primary actor name(s)

Secondary Actor(s) Secondary actor name(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Actor

• Anyone or anything with behavior

• May be a person or system

• Primary: The stakeholder who or which initiates an interaction with the system to achieve a goal. Is generally a category of individuals (a role).

• Secondary: Provides a service to the system. Is almost never a person.

Page 11: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

11 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions

Postconditions

Primary Actor(s)

Secondary Actor(s)

Trigger The action that caused the use case to be invoked

Main Scenario Step Action

Step # This is the “main success scenario” or “happy path”

Step # Description of steps in successful use case “execution”

Step # This should be in a “system-user-system, etc.” format

Extensions Step Branching Action

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Page 12: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

12 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions

Postconditions

Primary Actor(s)

Secondary Actor(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Step # Alternative paths that the use case may take

Open Issues

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Extension

• Could be an optional path(s)

• Could be an error path(s)

• Denoted in use case diagrams (UML) by <<extend>>

Page 13: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

13 CMSC 345, Version 9/07S. Mitchell

Number

Name

Summary

Priority

Preconditions

Postconditions

Primary Actor(s)

Secondary Actor(s)

Trigger

Main Scenario Step Action

Extensions Step Branching Action

Open Issues Issue # Issues regarding the use case that need resolution

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Page 14: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

14 CMSC 345, Version 9/07S. Mitchell

Number Unique use case number

Name Brief noun-verb phrase

Summary Brief summary of use case major actions

Priority 1-5 (1 = lowest priority, 5 = highest priority)

Preconditions What needs to be true before use case “executes”

Postconditions What will be true after the use case successfully “executes”

Primary Actor(s) Primary actor name(s)

Secondary Actor(s) Secondary actor name(s)

Trigger The action that causes this use case to begin

Main Scenario Step Action

Step # This is the “main success scenario” or “happy path.”

… Description of steps in successful use case “execution”

… This should be in a “system-user-system, etc.” format.

Extensions Step Branching Action

Step # Alternative paths that the use case may take

Open Issues Issue # Issues regarding the use case that need resolution

Use Case Specification Template*

*Adapted from A. Cockburn, “Basic Use Case Template”

Page 15: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

15CMSC 345, Version 9/07S. Mitchell

Number 1

Name Withdraw Money

Summary User withdraws money from one of his/her accounts

Priority 5

Preconditions User has logged into ATM

Postconditions User has withdrawn money and received a receipt

Primary Actor(s) Bank Customer

Secondary Actor(s) Customer Accounts Database

Use Case Specification Template Example

Continued …

Page 16: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

16

Trigger User has chosen to withdraw money

Main Scenario Step Action

1 System displays account types

2 User chooses account type

3 System asks for amount to withdraw

4 User enters amount

5 System debits user’s account and dispenses money

6 User removes money

7 System prints and dispenses receipt

8 User removes receipt

9 System displays closing message and dispenses user’s ATM card

11 User removes card

10 System displays welcome message

Extensions Step Branching Action

5a System notifies user that account funds are insufficient

5b System gives current account balance

5c System exits option

Open Issues 1 Should the system ask if the user wants to see the balance?

Page 17: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

17 CMSC 345, Version 9/07S. Mitchell

Specification Writing Guidelines

• No trace of design• Describes what the use case will do, not how

it will do it (e.g., UI type is irrelevant)• A dialogue between the user and the system• Complete, clear, and consistent

Page 18: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

18 CMSC 345, Version 9/07S. Mitchell

Use Case Diagrams

• A way of visualizing the relationships– between actors and use cases– among use cases

• “A graphical table of contents for the use case set” (Fowler)

Page 19: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

19 CMSC 345, Version 9/07S. Mitchell

1Withdraw

Money

2DepositMoney

3TransferMoney

4Check

Balance

ATM System

Bank Customer

Customer Accounts Database

primary actor

role

system name system boundary

secondary actor

use case

<<Customer Accounts

Database>>

alternative actor notation

stereotype

association

Page 20: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

20 CMSC 345, Version 9/07S. Mitchell

Using Use Case Specifications in Conjunction with Use Case Diagrams

• UML is a graphical modeling tool only.• Use case specifications are not part of the

UML• But, since each ellipse in a UML use case

diagram represents a functional requirement, it may in turn have an associated use case specification.

Page 21: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

21 CMSC 345, Version 9/07S. Mitchell

1Withdraw

Money

2DepositMoney

3TransferMoney

4Check

Balance

ATM System

Bank Customer

Customer Accounts Database

Teller 5View

TransactionHistoryprimary actor

Why can’t a Teller do the things that a Bank Customer can do? Especially if he is a customer?

He can. But he must “step into” the role of a Bank Customer.

Page 22: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

22 CMSC 345, Version 9/07S. Mitchell

1Withdraw

MoneyBank

Customer

Customer Accounts Database

1bWithdraw from

Savings

1aWithdraw from

Checking

<<extend>>

<<extend>>

Sub-use Case Diagram

This is an extend dependency.

It indicates that use case 1b is part of use case 1, but it may or may not be invoked.

The same is true of use case 1a.All dependencies are extend unless stereotyped otherwise.

note/comment

Page 23: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 25

The Problem

Bank Server

wanwan

ATM

ATM

ATM

ATM

Page 24: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 26

The ProblemA customer can:

Withdraw funds Query an account Transfer funds Delete a transaction in any moment so

• The transaction is aborted• The card is ejected

Customer records, account records debit card records are all mantained on the server.

Page 25: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 29

The Problem

A transaction starts when: Card is inserted Card is recognized (assumed true) Card validated PIN is entered & validated

The customer is allowed three attempts to enter the correct PIN; if the 3rd attempt fails the card is confiscated.

Page 26: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 30

The Problem

A card is composed by: A magnetic strip in which encodes:

• Start date;• Expiration date;• Serial no.

Page 27: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 31

The Problem

An ATM operator can: Start up and close down the ATM

to replenish the cash dispenserfor routine maintenance

Page 28: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 32

The Problem(what is not in)

It is assumed that functionality such asopen/close accountscreate/update/delete customer and cards

is provided by an existing system and is not part of the problem.

During modeling the Bank Server should be considered as part of the problem

Page 29: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 33

Case study development

Use case model - Req model

Static modeling - Analysis model

Object structuring – Analysis model

Dynamic modeling – Analysis model

Page 30: Unit 3 Functional Requirements. Syllabus Introduction Features and usecases Use case Scenarios Documenting use cases Levels of details SRS Document

Banking System Case Study 34

Use Case Model

Validate PIN

Withdraw funds

Val.PIN

Withdraw

Funds

Transfer

Funds

Query

AccountATMCustomer

Operator

Add Cash

Shutdown

Restart

<<include>>

<<include>>

<<include>>

Use case diagram