41
© 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

Embed Size (px)

Citation preview

Page 1: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall

Chapter 7Behavioral Modeling IIDeveloping Use Cases

Page 2: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 2

Chapter Topics

Structuring and developing use cases through Structuring and developing use cases through templates.templates.

When and how to generalize actors.When and how to generalize actors. When and how to extend the functionality of a use When and how to extend the functionality of a use

case.case. When and how to reuse use cases.When and how to reuse use cases. When and how to generalize use cases.When and how to generalize use cases. The features and the purpose of use case diagram.The features and the purpose of use case diagram. When and how to join or divide use case.When and how to join or divide use case. Using activity diagram to clarify the logical flow of Using activity diagram to clarify the logical flow of

use cases.use cases. Use case modeling as a framework for development Use case modeling as a framework for development

activities.activities. Managing details by creating supplements to use Managing details by creating supplements to use

cases. cases.

Page 3: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 3

Page 4: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 4

A Framework for the Development

Page 5: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 5

Develop Base Use Cases

What a “base” use case is?

A base use case is a fully formed, structured use case which serves as a base to develop other analysis and design artifacts.

Page 6: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 6

The Template

The template structures use cases by providing well-defined and ordered fields.

Page 7: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 7

Use Case Template

Please refer to able 7.1 on page 210 in the text book.

Page 8: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 8

Template Fields

Template fields represent the building blocks of the use cases, joined in a predefined, orderly manner.

Page 9: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 9

Template Fields

Name embodies the goal that the use case wants to

accomplish. ID

is unique numeric identifier for the use case. Scope

boundaries of the use case— defined by the system or the subsystem to which it belongs.

Priority decides the order of design and

implementation for use cases.

Page 10: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 10

Template Fields

Summary a long version of the use case name and a short

version of the scenario. Primary actor

is the actor whose goal identifies and drives the use case.

Supporting actor assist the primary actor in achieving the goal of

the use case.

Page 11: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 11

Page 12: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 12

Template Fields

Stakeholder any entity, human or otherwise, who has an

interest in the outcome of the use case. Precondition

defines the state of the system before a use case can start; post-condition defines the state of the system after a use case is complete.

Trigger the event that starts the use.

A flow an ordered set of activities that occur as the

actors and the system attempt to reach a goal.

Page 13: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 13

Normal Flow

Conduct ATM Transaction

Normal Flow: 1. Customer inserts the bank card.2. Customers enters password.3. System verifies password.4. System presents a list of transaction types that the

customer may conduct.5. Customer selects a type of transaction.

Normal flow is the best-case scenario

Page 14: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 14

Sub-Flows

Sub-flows identify the details of the steps in the normal flow

RegisterPatient Normal Flow: 1. The registration clerk enters or updates personal

data.

Sub Flows: 1.1 The registration clerk enters the Social Security Number of the new patient.

1.2 The registration clerk enters or updates patient’s address.

1.3 The registration clerk enters or updates patient’s phone number.

1.4 The registration clerk enters or updates the name, the address and the phone number of the patient’s closest relative.

Page 15: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 15

Alternate Flow and Exceptions

Alternate steps identify remedies; exceptions signify failure

Receive Patient Alternate

Flow/ Exceptions:

3.a Patient is new. Reception clerk directs the patient to registration…3.bPatient is not new but personal or insurance data has changed. Reception clerk directs the patient to registration…3.cPatient has lost the hospital ID card. Reception clerk directs the patient to registration…

Page 16: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 16

Non-Behavioral Requirements

Only when a non-behavioral requirements applies to a specific use case, the requirement is specified in the template.

Page 17: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 17

Template Fields

Open Issues questions that must be resolved before

the use case can be judged as complete. Audit fields

help us to keep track of the evolution of the use case.

Custom Fields specifies an attribute or requirement that

is specific to one use case or a set of use cases within the system.

Page 18: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 18

Page 19: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 19

Actor Dictionary

Actor Description Abstract Use Case (s)

Appointment Clerk

Makes appointment for the patient to receive medical service.

Make Appointment

Billing Clerk Maintains patient billing. Enter Bulk Payment

Hospital Clerk Generalizes: Appointment Clerk Billing Clerk Reception Clerk Registration Clerk

Resolve Patient Billing Issue

Reception Clerk

Receives patient on arrival at the hospital. Verifies registration. Arranges for the patient to receive medical service.

Receive Patient

Registration Clerk

Enters or updates patient’s personal and payment data. Issues a hospital card, if necessary.

Register Patient

George
Alignment and above.
Page 20: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 20

Dependencies: Include and Extend

An extend relationship is one in which a use case is created to extend the functionality of a base use case.

RegisterPatient Alternate Flow/

Exceptions: 2.a The patient is not new and insurance data has not changed. Registration clerk does not update the insurance data by default.

2.bThe patient wants to pay the entire bill or the co-payments by a credit card. Registration clerk verifies the credit card (Extend: 142 - Verify Credit Card) and records credit card information.

Page 21: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 21

Include Relationship

An include relationship is one in which one use case uses the functionality of another, independent, use case.

ReceivePatient Normal Flow: …

3. Reception clerk verifies that patient has been registered and registration is valid.

Alternate Flow/ Exceptions: 3.a Patient is new. Reception clerk directs the patient to registration. (Include: 140 - Register Patient.)

Page 22: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 22

Use Case Diagram for Dependencies

In a use case diagram, dependency type is indicated by the direction of an arrow.

Page 23: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 23

Page 24: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 24

Base UC Arrow’s Direction

Referenced UC

Extended UCRegister Patient

Extending UCVerify Credit Card

Including UCReceive Patient

Included UCRegister Patient

Page 25: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 25

Use Case Generalization

We generalize use cases when the they achieve the same goal by different means.

Page 26: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 26

Page 27: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 27

Use Case Diagram

Use case diagram is a meta-model that portrays associations among actors, use cases and the system.

Page 28: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 28

Page 29: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 29

Separating and Joining Use Cases

 We delineate them.  We divide them into more use cases.

 We combine them.

Page 30: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 30

Delineating Use Cases

One use case must have oneone primary actor, oneone useful goal and oneone system.

Page 31: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 31

Dividing Use Cases

New requirements or the challenge of complexity may demand that a use case be divided: Vertical division is necessary if the use

case has too many parallel steps. Horizontal division is necessary if the flow

is too complex or the building blocks of the use case lack unity.

Page 32: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 32

Refactoring

Refactoring abstracts and reorganizes common behavior among use cases into new use cases.

Page 33: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 33

Activity Diagram

Activity diagram depicts the flow from activity to activity. It presents a visual, dynamic view of the system and its components.

Page 34: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 34

Page 35: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 35

The Building Blocks of Activity Diagram

Refer to Table 7.4 on page 240 in the text book.

Page 36: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 36

Uses of Use Cases

Use cases provide a crucial framework for analysis, design, implementation and deployment activities.

Page 37: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 37

Uses of Use Cases

Requirements GatheringRequirements Gathering Use cases provide the base tools for

gathering requirements within a meaningful context.

Requirements TraceabilityRequirements Traceability Use cases and their supporting documents

are the prime sources for tracing requirements.

Business RulesBusiness Rules Use cases are the framework for gathering

business rules. System BehaviorSystem Behavior

The external behavior of any open system can be captured effectively through use cases.

Page 38: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 38

Uses of Use Cases

Object DerivationObject Derivation By launching a cycle of gathering requirements from

the use cases, we can arrive at many of the objects that would form the structure of the system.

Incremental DevelopmentIncremental Development By prioritizing use cases and their dependencies, we

can build a system incrementally. Base for User InterfaceBase for User Interface

Use cases describe the basics messages that the actor and the system must exchange to achieve a goal.

Test Case DefinitionTest Case Definition Use cases are the conceptual blueprints for functional

test cases. Base for User DocumentationBase for User Documentation

Use cases are built to describe the interaction between a user type and a system.

Business Process ModelingBusiness Process Modeling Use cases can be used to model business processes,

prior to, after, or independent from an information system.

Page 39: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 39

Page 40: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

© 2009 Pearson Education, Inc. Publishing as Prentice Hall 7 - 40

Next: Structural Modeling

The basic building blocks of an information systems are objectsobjects.

An object is created from a mold called classclass.

To make objects we have to make classes, and this is the starting point of the next chapter.

Page 41: © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 7 Behavioral Modeling II Developing Use Cases

7 - 41© 2009 Pearson Education, Inc. Publishing as Prentice Hall

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic,

mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.

Copyright © 2009 Pearson Education, Inc.  Copyright © 2009 Pearson Education, Inc.  Publishing as Prentice HallPublishing as Prentice Hall