Use Case Modeling. Use case diagram For each use case we develop Object class diagram (with...

24
Use Case Modeling

Transcript of Use Case Modeling. Use case diagram For each use case we develop Object class diagram (with...

Use Case Modeling

Use Case Modeling

Use case diagram For each use case we develop

Object class diagram (with attributes only)System sequence diagram (analysis)Detailed sequence diagram (design)Updated object class diagram [with both

attributes and programs (methods)] Then put together object class diagrams for all use

cases and have one such diagram for entire system

2

What is Use Case Modeling?

use case model: a view of a system that emphasizes the behavior as it appears to outside users. A use case model partitions system functionality into transactions (‘use cases’) that are meaningful to users (‘actors’).

3

Use Case Modeling: Core Elements

Construct Description Syntax

use case A sequence of actions, including variants, that a system (or other entity) can perform, interacting with actors of the system.

actor A coherent set of roles that users of use cases play when interacting with these use cases.

system boundary

Represents the boundary between the physical system and the actors who interact with the physical system.

UseCaseNam e

ActorNam e

4

5

Construct Description Syntax

association The participation of an actor in a use case. i.e., instance of an actor and instances of a use case communicate with each other.

generalization A taxonomic relationship between a more general use case and a more specific use case.

extend A relationship from an extension use case to a base use case, specifying how the behavior for the extension use case can be inserted into the behavior defined for the base use case.

Use Case Modeling: Core Relationships

<<extend>>

5

Construct Description Syntax

include An relationship from a base use caseto an inclusion use case, specifyinghow the behavior for the inclusion usecase is inserted into the behaviordefined for the base use case.

Use Case Modeling: Core Relationships (cont’d)

<<include>>

6

Use cases help…

· Capture the system's functional requirements from the users' perspective

· Actively involve users in the requirements-gathering process

· Provide the basis for identifying major classes and their relationships

· Serve as the foundation for developing system test cases

7

Use Case Diagrams

Actor Line: actor communicates with or is associated

with use-case

Use Case Modeling (cont’d)

8

Use Case relationships: <<uses>>: one use case always involves the

steps of another <<extends>>: under certain conditions, a use case

follows a variant

9

Goals of Use Cases Interactions that provide value to actors No implementation specific language

No assumptions about how the use case may be realized in code or user-interface

Note: use-cases drive the whole life-cycle, and they get refined – implementation specific use-cases

User-appropriate level of detail General at requirements gathering stage

User-appropriate volume Large systems: no more than 70-80 use cases Small number of use cases – forces abstraction

10

ACTOR:What is an actor?

An actor is some one or something that must interact with the system under development

UML notation for actor is stickman, shown below.

Customer Manager Cashier

11

USE CASE:USE CASE documentation example:

The following use case describes the process of opening a new account in the bank.

Use case :Open new account

Actors :Customer, Cashier, Manager

Purpose :Like to have new saving account.

Description :A customer arrives in the bank to open the new

account. Customer requests for the new account

form, fill the same and submits, along with the

minimal deposit. At the end of complete successful

process customer receives the passbook.

Type :Primary use case.

12

OOAD --- USE CASE driven

Capture,clarify& validate use cases

Analysis Design &Implementation

Implement use cases

Use cases make up the glue

Test

Verify that use casesare satisfied

13

USE CASE Diagram:Use case diagram for the shown functionality.

Balance status report

Withdraw cash

Validation

uses

CustomerClerk

Manager

extends

ATM

14

Flow of Events: A flow of events document is created for each use case. Details about what the system must provide to the actor when the

use is executed. Typical contents

How the use case starts and ends Normal flow of events Alternate flow of events Exceptional flow of events

Typical Course of Events has:

Actor Action(AA)

System Response(SR)

15

Normal Flow of Events:

For withdrawal of cash: 1.(SR) The ATM asks the user to insert a card. 2.(AA) The user inserts a cash card. 3.(SR) The ATM accepts the card and reads its serial number. 4.(SR) The ATM requests the password. 5.(AA) The user enters 1234. 6.(SR) The ATM verifies the serial number and password with the

bank and gets the notification accordingly. 7.(SA)The ATM asks the user to select the kind of transaction. 8.(AA)User selects the withdrawal.

16

Normal Flow of Events:

Contd... 9.(SR)The ATM asks for the amount of cash; user enters $(s). 10.(SR)The ATM verifies that the amount of cash is within

predefined policy limits and asks the bank, to process the transaction which eventually confirms success and returns the new account balance.

11.(SR) The ATM dispenses cash and asks the user to take it. 12.(AA) The user takes the cash. 13.(SR) The ATM asks whether the user wants to continue. 14.(AA) The user indicates no.

17

Normal Flow of Events:

Contd... 15.(SR) The ATM prints a receipt, ejects the card and asks the user

to take them 16.(AA) The user takes the receipt and the card. 17.(SR) The ATM asks a user to insert a card.

18

Alternative Flow of Events:

For withdrawal of cash use case: 9. The ATM asks for the amount of cash; the user has change of

mind and hits the “cancel”.

19

Exceptional Flow of Events:

For withdrawal of cash use case: 3. Suspicious pattern of usage on the card. 10. The machine is out of cash. 11. Money gets stuck in the machine.

20

:Customer :ATM :BankRequest password

Verify accountEnter the password

Account o.k.Request option

Enter option

Request amount

Enter the amountUpdate transactionTransaction commit

Insert card

Dispense cashRequest take cash

Take cashRequest continuation

TerminatePrint receipt ,eject card

Request take cardTake card

Display main screen and prompt for the card.

:TransactionCreate Transaction

Transaction complete

Sequence Diagram [for withdrawal of cash, normal flow]

21

Collaboration Diagram [for withdrawal of cash, normal flow]

1. Insert cardEnter password, Enter kindEnter amount,Take cash, Take cardcancel,Terminate, Continue

Display main screen unreadable card message,request password,request kind, request amount,canceled message, eject card, failure message,dispense cash, request take cashrequest continuation,print receipt, request take cardbad account message,bad bank account message

Verify account,process transaction

Transaction succeedTransaction failedaccount o.k.bad account,bad password,bad bank code

Create TransactionTransaction complete

CUSTOMER

BANK

ATM TRANSACTION

22

Class Diagram [for withdrawal of cash, normal flow]

Customer

Transaction

1

0..*

1

0..*

ATMSystem

1..*

1..*

1..*

1..*

Bank[Branch]

1

1..*

1

1..*1

1

1

1

23

Component Diagram [for withdrawal of cash]

policy.dll

Branch

Bank.dllcustomer.dll

ATM.exe

Branch

Bank.exe

Bank

Server.exe

24