lecture # 12 sre.pdfuse case diagram of atm presentation outline. use case modeling develop...

46
Software Requirements Engineering Lecture # 12 Refining the System Definition (Use-Cases)

Upload: others

Post on 10-Oct-2020

10 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Software Requirements Engineering

Lecture # 12

Refining the System Definition

(Use-Cases)

Page 2: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

ALI JAVED

Lecturer

SOFTWARE ENGINEERING DEPARTMENT

U.E.T TAXILA

Email:: [email protected]

Office Room #:: 7

Page 3: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Case Modeling

Scenario

Use Case Scenario

Use Case Diagram

Documenting Use Cases

Banking Case Study

Use Case Modeling of ATM

Use Cases for ATM system

Actors for ATM system

Detailed Description of Use Cases

Use Case Diagram of ATM

Presentation Outline

Page 4: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Case Modeling

Develop

Scenarios

Develop

Use Case Diagram

Develop

Use Cases

(Descriptions)

scenario refers to a

single path through

a use case

This is the process

suggested by the

unified process

Page 5: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Identify actors

Identify use cases

Link actors to use cases

Identify relationships between use cases

Consider scenarios

Write use case descriptions

Validate with stakeholders

Use Case Modeling

Page 6: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

In UML the term scenariorefers to a single path througha use case

The term “Scenarios” refer todifferent possible courses thatdifferent instances of same usecase might take

A use case usually has severalassociated scenarios

Scenario

Page 7: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Identifying Scenarios

Consider all the possibilities in the use case

Identify the normal (primary) scenario associated with the usecase

What typically happens

Identify the exceptions to the normal action:-

Alternative scenarios Things that could happen

Exceptional scenarios

Things that could be considered errors that need to becaught

Each scenario should be presented as a series of simplenumbered steps in text format

Page 8: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Normal Scenario:

1. Switch on kettle to boil water. [A1: Kettle empty]

2. Place tea bag and milk in mug.

3. When kettle has boiled pour boiling water into mug.

4. Let tea brew and then remove tea bag and put tea bag in the bin.

Simple Scenario – Make Tea

Page 9: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Alternative Scenarios:

A1. Kettle empty1. Fill Kettle with water.

2. Use case continues from step 1.

Exceptional Scenarios:

E1. No milk1. Sorry, have tea without milk.

2. Use case terminates.

Simple Scenario – Make Tea

Page 10: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Exercise 1 – Use Case Diagram

Draw a use case diagram for the space invader game below:

http://www.neave.com/games/invaders/

Page 11: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Exercise 1 Solution

Move Right

Fire Laser

View High Scores

Play Game

Player

Move Left

Page 12: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Remember in Space Invaders One use case was “move left”

Identify

Normal Scenario

Alternative Scenario

Exceptional Scenarios

Exercise 2 – Use Case Scenarios

Page 13: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Exercise 2 - Use Case Scenarios (for the Move Left use case)

Normal Scenario 1.Player indicates that the base moves toleft

2.The system moves the base left

Alternative Scenario 1.Player indicates that the base moves toleft

2.A bullet arrives where the base hasmoved to

3.The base explodes

Exceptional Scenario 1.Player indicates that the base moves toleft

2.The base is at the extreme left of thescreen

3.The base stays where it is

Page 14: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Documenting Use Cases

Use Case Description is

A detailed description of a usecase

Will be text

Typically in the form of a usecase template

Can include:

State Diagrams

Sequence Diagrams and more

Describes what is required tosatisfy the use case

Page 15: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Documenting Use Cases

How much detail is enough?

What to include?

Name

Summary

Dependency (on other use cases)

Actors

Trigger condition A 'triggers' section describes the event that causes the use case to be

initiated.

Page 16: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Preconditions

Conditions that are true at start of use case

Flow of Events

Narrative description of basic path

Alternatives

Narrative description of alternative paths.

Exceptions

what happens when things go wrong may be described in this section

Post-condition

Condition that is true at end of use case?

Documenting Use Cases

Page 17: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Candidate objects

Attributes

Operations

Forms a basis for subsequent modeling activities (To be used laterin class diagrams, interaction sequence diagrams, state diagrams,etc.

Extracting information from Use Case modeling

Page 18: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a
Page 19: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a
Page 20: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Problem Description

A bank has several automated teller machines (ATMs), which aregeographically distributed and connected via a wide area network to acentral server.

Each ATM machine has a card reader, cash dispenser, a keyboard/display,and a receipt printer.

By using the ATM machine, a customer can withdraw cash from eitherchecking or savings account, query the balance of an account, or transferfunds from one account to another.

A transaction is initiated when a customer inserts an ATM card into thecard reader. Encoded on the magnetic strip on the back of the ATM card arethe card number, the start date, and the expiration date.

Assuming the card is recognized, the system validates the ATM card todetermine

that the expiration date has not passed, that the user-entered PIN matches the PIN maintained by the system, that the card is not lost or stolen.

Page 21: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

The customer is allowed three attempts to enter the correct PIN; the cardis confiscated if the third attempt fails. Cards that have been reported lostor stolen are also confiscated.

If the PIN is validated satisfactorily, the customer is prompted for awithdrawal, query, or transfer transaction.

Before withdrawal transaction can be approved, the system determinesthat sufficient funds exist in the requested account, that the maximumdaily limit will not be exceeded, and that there are sufficient funds availableat the local cash dispenser.

If the transaction is approved, the requested amount of cash is dispensed,a receipt is printed containing information about the transaction, and thecard is ejected.

Problem Description

Page 22: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Problem Description

Before a transfer transaction can be approved, the system determines

that the customer has at least two accounts and

that there are sufficient funds in the account to be debited.

For approved query and transfer requests, a receipt is printed and cardejected.

A customer may cancel a transaction at any time; the transaction isterminated and the card is ejected. Customer records, account records, anddebit card records are all maintained at the server.

An ATM operator may start up and close down the ATM to replenish the ATMcash dispenser and for routine maintenance.

It is assumed that functionality to open and close accounts and to create,update, and delete customer and debit card records is provided by an existingsystem and is not part of this problem.

Page 23: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Case Model

The use cases are described in the use case model

There are two actors of this system

ATM Customer

Operator

Page 24: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

ATM Customer

Withdraws funds from the checking or savings account

Query the balance of an account

Transfer funds from one account to another

The ATM customer interacts with the system via the ATM cardreader, keyboard/display, cash dispenser, and receipt printer

Page 25: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

ATM Operator

Shutdowns the ATM

Replenishes the ATM cash dispenser

Starts the ATM

Page 26: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Cases for ATM Operator

Add cash

Startup

Shutdown

Page 27: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Uses Case Diagram for ATM Operator

Startup

Shutdown

Operator

Add

cash

Page 28: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Cases for ATM Customer

Withdraw funds

Query account

Transfer funds

Page 29: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Uses Case Diagram for ATM Customer

Query

Account

Transfer

Funds

ATM

Customer

Withdraw

Funds

Page 30: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

30

Organizing Use Cases for ATM Customer

Comparing these three use cases, it can be seen that thefirst part of each use case – namely, the PIN validation – iscommon to all three use cases

This common part of the three use cases is factored out asan abstract inclusion use case called Validate PIN

The Withdraw funds, Query account, Transfer funds usecases can each be rewritten more concisely as concreteuse cases that include the Validate PIN abstract use case

Page 31: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

31

Uses Case Diagram for ATM Customer

ATM

Customer

Withdraw

funds

Query

account

Transfer

funds

Validate

PIN

«include»

«include»

«include»

Page 32: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Use Case Diagram for ATM

ATM

Customer

Withdraw

funds

Query

account

Transfer

funds

Startup

Shutdown

Validate

PIN

Operator

Add

cash

«include»

«include»

«include»

Page 33: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

33

Use Cases of the ATM System

Abstract use cases

Validate PIN

Concrete use cases

Withdraw Funds

Query Account

Transfer Funds

Page 34: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Validate PIN Use Case - 1

Name: Validate PIN

Summary : System validates customer PIN

Dependency: none

Actors: ATM Customer

Preconditions: ATM is idle, displaying a Welcome message.

Page 35: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Flow of Events: Basic Path

1. Customer inserts the ATM card into the Card Reader

2. If the system recognizes the card, it reads the card number

3. System prompt customer for PIN number

4. Customer enters PIN

5. System checks the expiration date and whether the card is lost orstolen

6. If card is valid, the system then checks whether the user entered PINmatches the card PIN maintained by the system

7. If PIN numbers match, the system checks what accounts areaccessible with the ATM card

8. System displays customer accounts and prompts customer fortransaction type: Withdrawal, Query, or Transfer

Validate PIN Use Case - 2

Page 36: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Validate PIN Use Case - 3

Alternatives:

If the system does not recognize the card, the card is ejected

If the system determines that the card date has expired, the card isconfiscated

If the system determines that the card has been reported lost orstolen, the card is confiscated

If the customer-entered PIN does not match the PIN number for thiscard, the system re-prompts for PIN

If the customer enter the incorrect PIN three times, the systemconfiscates the card

If the customer enters Cancel, the system cancels the transaction andejects the card

Post condition: Customer PIN has been validated

Page 37: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Withdraw Funds Use Case - 1

Name: Withdraw Funds

Summary : Customer withdraws a specific amount of funds from avalid bank account

Dependency: Include Validate PIN abstract use case

Actors: ATM Customer

Preconditions: ATM is idle, displaying a Welcome message.

Page 38: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Withdraw Funds Use Case - 2

Flow of Events: Basic Path

1. Include Validate PIN abstract use case

2. Customer selects Withdrawal, enters the amount, and selects theaccount number

3. System checks whether customer has enough funds in the accountand whether the daily limit will not be exceeded

4. If all checks are successful, system authorizes dispensing of cash

5. System dispenses the cash amount

6. System prints a receipt showing transaction number, transactiontype, amount withdrawn, and account balance

7. System ejects card

8. System displays Welcome balance

Page 39: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Withdraw Funds Use Case - 3

Alternatives:

If the system determines that the account number is invalid, itdisplays an error message and ejects the card

If the system determines that there are insufficient funds in thecustomer’s account, it displays an apology and ejects the card

If the system determines that the maximum allowable dailywithdrawal amount has been exceeded, it displays an apology andejects the card

If the ATM is out of funds, the system displays an apology, ejectsthe card, and shuts down the ATM

Post-condition: Customer funds have been withdrawn

Page 40: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

40

Query Account Use Case - 1

Name: Query Account

Summary: Customer receives the balance of a validbank account

Actor: ATM Customer

Dependency: Include Validate PIN abstract use case

Precondition: ATM is idle, displaying a Welcome message

Page 41: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

41

Query Account Use Case - 2

Flow of Events: Basic Path

1. Include Validate PIN abstract use case

2. Customer selects Query, enters account number

3. System reads account balance

4. System prints a receipt showing transaction number,transaction type, and account balance

5. System ejects card

6. System displays Welcome message

Page 42: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

42

Query Account Use Case - 3

Alternative: If the system determines that the accountnumber is invalid, it displays an error message and ejectsthe card

Post-condition: Customer account has been queried

Page 43: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

43

Transfer Funds Use Case - 1

Name: Transfer Funds

Summary: Customer transfers funds from one valid bank account to another

Actor: ATM Customer

Dependency: Include Validate PIN abstract use case

Precondition: ATM is idle, displaying a Welcome message

Page 44: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

44

Transfer Funds Use Case - 2

Flow of Events: Basic Path

1. Include Validate PIN abstract use case

2. Customer selects Transfer and enters amounts, fromaccount, and to account

3. If the system determines the customer has enough fundsin the from account, it performs the transfer

4. System prints a receipt showing transaction number,transaction type, amount transferred, and account balance

5. System ejects card

6. System displays Welcome message

Page 45: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

45

Transfer Funds Use Case - 3

Alternatives:

If the system determines that the from account number isinvalid, it displays an error message and ejects the card

If the system determines that the to account number isinvalid, it displays an error message and ejects the card

If the system determines that there are insufficient fundsin the customer’s from account, it displays an apology andejects the card

Post-condition: Customer funds have been transferred

Page 46: Lecture # 12 SRE.pdfUse Case Diagram of ATM Presentation Outline. Use Case Modeling Develop Scenarios Develop Use Case Diagram Develop Use Cases (Descriptions) scenario refers to a

Any question