Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems...

32
Chapter 6: Chapter 6: Structuring Structuring Requirements: Use Case Requirements: Use Case Description and Description and Diagrams Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer

Transcript of Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems...

Page 1: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Chapter 6:Chapter 6:Structuring Requirements: Structuring Requirements:

Use Case Use Case Description and DiagramsDescription and DiagramsObject-Oriented Systems Analysis and

DesignJoey F. George, Dinesh Batra,

Joseph S. Valacich, Jeffrey A. Hoffer

Page 2: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Chapter ObjectivesChapter ObjectivesAfter studying this chapter you should

be able to:– Understand how to structure requirements with

use case diagrams.– Explain the basics of use case construction

using UML standards.– Construct use case diagrams.– Write text-based use cases.

Page 3: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Page 4: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is Requirements Structuring?What Is Requirements Structuring?The process of analyzing, organizing, and

modeling the requirements obtained via interviews, questionnaires, observation, and document analysis

Relevant UML models include:– Use Cases – Class Diagrams – Interaction Diagrams, and – Activity or Statechart Diagrams

Page 5: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use Case DeliverablesUse Case Deliverables

Use case diagrams

Use case descriptions (narratives)

Page 6: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is a Use Case?What Is a Use Case? A depiction of a system’s functionality or behavior

as a response to a user request

It is a description of the actions that a system performs that yields an observable result to a particular user.

A use case consists of a set of interactions between a user and a system relating to a single function (e.g. enter an order, determine price, withdraw cash)

A use case may produce many outcomes. These are called scenarios (or sequences)

Page 7: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is a Scenario?What Is a Scenario? A scenario (or a sequence) is a single outcome from the

system as part of performing a larger use case.

A scenario produces only one outcome.

The customer browses the catalog and adds desired items to the shopping cart. When ready to check out, customer enters credit card information, and confirms the order. The system checks authorization, and confirms the sale.

If instead, the customer decides to save the shopping cart for later use, or if the credit card information is invalid, those are two different scenarios

Both of the above bullet points are the same use case, but the are 3 different scenarios

Page 8: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

A Use Case DiagramA Use Case Diagram

Page 9: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

UML Use Case UML Use Case Diagram SymbolsDiagram Symbols

Use Case Actor Boundary Connection Include relationship Extend relationship Generalization

<<include>>

<<extend>>

Page 10: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is an Actor?What Is an Actor?

• An external entity that interacts with the system

• Most actors represent user roles, but actors can also be external systems.

• An actor is a role, not a specific user. As such, many users can play the same role. Alternatively, one user can play many roles.

Page 11: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is a Boundary?What Is a Boundary?

The dividing line between the system and its environment

- Use cases are within the boundary.

- Actors are outside of the boundary.

Page 12: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is a Connection?What Is a Connection?

An association between an actor and a use case

Depicts a usage relationship

Connection does not indicate data flow

Page 13: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is an <<include>> What Is an <<include>> Relationship?Relationship?

A connection between two use cases

Indicates a use case that is used (invoked) by another use case

Calls to general purpose functions

UML uses a dashed arrow (pointing to the invoked use case) and the word <<include>>

Page 14: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

An <<include>> RelationshipAn <<include>> Relationship

Page 15: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Another example of anAnother example of an<<include>> Relationship<<include>> Relationship

Both buying a house and selling a house require house valuation

- You can make a single house valuation use case, and have both other use cases use (invoke) this use case using an <<include>> relationship

Page 16: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

What Is an <<extend>> What Is an <<extend>> Relationship?Relationship?

A connection between two use cases

Extends a use case by adding new behavior or actions (a sub-class)

A specialized use case extends a general use case

UML uses a dashed arrow (pointing to the extended use case) and the word <<extend>>

Page 17: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Examples ofExamples of<<extend>> Relationship<<extend>> Relationship

Buying a product as a registered customer extends buying a product.

- Buying a product as a registered customer adds functionality to buying a product

Registering for a special class extends registering for a class use case.

- Registering for special classes requires instructor permission plus all steps required for registering for a regular class

Page 18: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Example of <<include>> & <<extend> Example of <<include>> & <<extend> RelationshipsRelationships

A Use Case DiagramWith both

<<include>> relationships,

and <<extend>> relationship

Page 19: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use Case Diagram in MS VisioUse Case Diagram in MS Visio

Page 20: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Include vs. ExtendInclude vs. Extend

Use <<include>> if you want to factor a common behavior that two or more use cases can use

Use <<extend>> if you want to model an extension to a complete “more general” use case that exists in its own right, but you are looking to extend/improve the behavior

Page 21: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

GeneralizationGeneralization

The act of grouping or categorizing objects into a more general or generic classes or types of objects

UML uses a solid arrow pointing to the

more general class

Page 22: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Actors may be grouped in generalized categories.

Here as “Customer”

GeneralizationGeneralization

Page 23: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Generalized and Abstract Generalized and Abstract Use CasesUse Cases

A generalized use case is a use case that is part of an <<include>> or <<extend>> relationship. It is the use case that is on the arrow head side

An abstract use case is a use case that does not have any actors. It is only used by other use cases. Example: track sales and inventory data. This use case is only used by other use cases.

Page 24: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use Case Descriptions Use Case Descriptions (Use Case Narratives)(Use Case Narratives)

A written narrative and description of a use case

Document containing detailed specifications for a use case

Document can be written with no specific format, or using a use case template format

Page 25: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Page 26: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Sample Format for Sample Format for Use Case NarrativesUse Case Narratives

Title – name of use case, should match name in use case diagram

Primary actor – the primary user role

Other actors – other user roles

Level – the level of the descriptive detail. summary, intermediate or detail level

Page 27: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Sample Format for Sample Format for Use Case narratives Use Case narratives (Cont.)(Cont.)

Stakeholders – any group or individual with an interest in the function of the use case

Precondition – conditions that must be satisfied (must exist) before executing the use case

Minimal guarantee – the least amount of processing that is promised by the use caseExample: use case fails, roll back transaction.

Success guarantee – outputs that is expected if the use case succeeds

Page 28: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Sample Format for Sample Format for Use Case narratives Use Case narratives (Cont.)(Cont.)

Trigger – an event that initiates the use case. Example: a deposited check, an executed sales order, a call from another use case

Main success scenario – the step-by-step description of the sequence of interactions between the actor and the use case to bring the main scenario to success

Extensions – detailed description of the else scenarios. Description of abnormal “what if” conditions.e.g. description of interaction if credit card is invalid

Page 29: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use case description at summary level.

High level bulleted items.

Page 30: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use case description at intermediate level.

More detail descriptive use case interactions

Page 31: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

Use Case AdvantagesUse Case Advantages Every use case is a potential high level requirement A use case captures the detail of the interactions

with the system that must be implemented A use case is a good starting point for the

elaboration phase A use case represents the actor’s point of view A use case should only describe the external visible

behavior of the interaction with the actor A use case should not focus on implementation

Page 32: Chapter 6: Structuring Requirements: Use Case Description and Diagrams Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.

RecapRecapAfter studying this chapter we learned

to:– Understand how to structure requirements

with use case diagrams.– Explain the basics of use case

construction using UML standards.– Construct use case diagrams.– Write use cases descriptions/narratives.