36
This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Embed Size (px)

Citation preview

Page 1: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

This section has been adapted from Dr. Scott Fleming of U. Memphis

Details about Use Cases

Page 2: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

What are “fully dressed” use cases?

• All steps and variations written in detail

• Structured template– Tend toward the formal– However, rough

sketching can be useful

http://flic.kr/p/a6qunq

Page 3: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

“Fully dressed” UC template

• UC name• Scope• Level• Primary actor• Stakeholders and

interests• Preconditions• Success guarantees

• Main success scenario• Extensions (or

alternative flows)• Special requirements• Technology and data

variations list• Frequency of

occurrence• Miscellaneous

Page 4: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Use Cases are a Bundle

• Each use case is a bundle of scenarios• Usually include a “main success scenario” and

“exception scenarios”

Page 5: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Use Case Name

• Start with a verb• Examples:– Read Article– Write Article– Moderate Comment

Page 6: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Scope

• Will always be the software system under development for us

• Example:– Online Magazine Content Management System

• There also business use cases, but we don’t care about them in this class

Page 7: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Level

Two levels that we care about:

• User-goal level: describes scenarios that fulfill the goals of the primary actor– Most common

• Subfunction level: describes substeps to support a user goal– Used to factor out common text from other use cases– Good for handling common use cases like “Log in”

Page 8: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Primary actor

• Principal actor that calls upon system services to fulfill a goal– Usually human, but not always

Page 9: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Stakeholders and interests list

• “The [system] operates a contract between stakeholders, with the use cases detailing the behavioral parts of that contract… The use case, as the contract of behavior, captures all and only the behaviors related to satisfying the stakeholders’ interests” –Cockburn (2001)

• Example stakeholders and interests:– Subscriber: Wants interesting and amusing articles because the

subscriber wants to get money’s worth; wants to be involved in a community of like-minded users to discuss topics and provide feedback to the magazine

– Editor: Wants high-quality written articles because low-quality articles reduce reader confidence and satisfaction

Page 10: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Stakeholders and interests list

• “The [system] operates a contract between stakeholders, with the use cases detailing the behavioral parts of that contract… The use case, as the contract of behavior, captures all and only the behaviors related to satisfying the stakeholders’ interests” –Cockburn (2001)

• Example stakeholders and interests:– Subscriber: Wants interesting and amusing articles because the

subscriber wants to get money’s worth; wants to be involved in a community of like-minded users to discuss topics and provide feedback to the magazine

– Editor: Wants high-quality written articles because low-quality articles reduce reader confidence and satisfactionContains a Why description!

Page 11: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Preconditions

• Things that must always be true be the scenario begins– May imply completion of another UC’s scenario

• Examples:– User has logged in– Comment exists in moderation queue

• Skip uninteresting or obvious preconditions– Anti-example: Editor has editing experience– Anti-example: Subscriber can use web site

Page 12: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Success guarantees (postconditions)

• Things that must be true after the success scenario or some alternative path– Should meet the needs of all stakeholders

• Example:– User has access to subscriber-only content– Comment appears in article’s comment thread– Edits to article are saved

Page 13: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Main success scenario• Sequence of steps in a scenario of a successful

typical use of the system• Three types of steps:– Interaction between actors– Validation (usually by system)– State change of system (e.g., recording or modifying

something)– (Additionally, step 1 may indicate a trigger event)

• Most actor actions should have a system response• Defer conditionals to Extensions section• Idiom: capitalize actors names

Page 14: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Main Success Scenario 1:Post Comment on Article

1. Subscriber access article2. System presents article to subscriber, with comments thread3. Subscriber presses “Post comment”4. System confirms that subscriber is permitted to post comments5. System presents text editor6. Subscriber enters comment text7. Subscriber submits comment8. System records subscriber name, date of comment, comment

text, and article that was commented on9. System posts comment at end of comment thread

Page 15: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Extensions (or alternative flows)• All other scenarios and branches

– May end in success or failure• Example:

– 1a. Used filtered language [words in the comment text on filtered list]6. Subscriber writes word on filtered word list7. ???8. System shows the text editor, the error message, “Please do not use these words

in your post!”, and the words in the editor highlighted

– 1b. Subscriber is banned from posting comments [subscriber is on a “banned from posting” list]

3. Subscriber presses “Post comment”4. System identifies that the subscriber is not permitted to post comments5. System shows error message, “You are not allowed to post comments.”

– Guideline: write conditions as something that can be detected by system or actor

Page 16: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Extensions (or alternative flows)• All other scenarios and branches

– May end in success or failure• Example:

– 1a. Used filtered language [words in the comment text on filtered list]6. Subscriber writes word on filtered word list7. ???8. System shows the text editor, the error message, “Please do not use these words

in your post!”, and the words in the editor highlighted

– 1b. Subscriber is banned from posting comments [subscriber is on a “banned from posting” list]

3. Subscriber presses “Post comment”4. System identifies that the subscriber is not permitted to post comments5. System shows error message, “You are not allowed to post comments.”

– Guideline: write conditions as something that can be detected by system or actor Contains the condition

Numbering starts at the pointfrom the main success scenario

Page 17: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Extensions (cont’d)• At end, the extension merges back with the main

success scenario unless the extension indicates otherwise

• Complex extensions might be better expressed as a separate UC

• Example: a condition that is possible during any step of the main scenario:– *a. System crashes…

• Example: branching to another use case:– 2c. Author performs Edit Article in response to editor

feedback

Page 18: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Special requirements

• Non-functional requirements relevant to the UC– Ex: Section 508 (web accessibility), HIPAA (health

information privacy), etc• Examples:– Every image must have associated alternative text

for screen readers– Identifiable information of patients cannot be

disclosed to non-employees

Page 19: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Technology and data variations list

• Constraints on how to build the system– Typically imposed by the customer

• Examples (reference relevant steps):– 4a. System must be compatible with Internet

Explorer 8, Chrome 22, Safari 4, and Firefox 17– 5a. System will present its mobile user interface

when accessed using a mobile device with a four inch screen or smaller

Page 20: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

How could creating “fully dressed”use cases be useful?

(Why write them?)

Page 21: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

How could creating “fully dressed”use cases be useful?

• Aid for thinking through what to build• Help with detailed planning• Reveal other use cases• ? Documenting requirements ?• ? Communicating with customer ?

Project-specific costs/benefitsvery important to consider!

Page 22: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Requirements derived from a Use Case

FR 1: Subscriber posts commentFR 1.1: Subscriber can post a comment associated with an articleFR 1.2: Every comment appears at the bottom of the article textFR 1.3: Comment stores the comment text, the subscriber name, the comment date of posting, and the associated article identifierFR 1.4: Comments containing offensive words have posting restrictionsFR 1.4.1: Comments posted by subscribers may not contain offensive wordsFR 1.4.2: Comments posted by moderators may contain Offensive WordsFR 1.4.3: Offensive words appear on the “offensive words list”

This might not be necessary depending on the project.Some developers are good at identifying necessary

information from the use case directly.

Page 23: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Consider this motivating example

At requirements workshop, an editorsays she needs to “log in to the system”

Is he making assumptions about the solution?

How might that limit you, as the designer?

How can you prevent customersfrom accidentally imposingunnecessary requirements?

Page 24: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Guideline: Write in essential style

• Express narrative at level of– user’s intentions and– system’s responsibilities

• Avoid UI details!!

Page 25: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

What is wrong with this example?

1. Moderator enters ID and password in dialog box.

2. System authenticates Moderator3. System displays the “edit users” window

Page 26: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

What is wrong with this example?

1. Moderator enters ID and password in dialog box.

2. System authenticates Moderator3. System displays the “edit users” window

• Limits possible designs by specifying UI

Page 27: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Here’s an essential-style example

1. Moderator identifies self.2. System authenticates Moderator’s identity.

• This version leaves open novel solutions such as hardware authenticators that the other system could not accomodate

Page 28: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Here’s another motivating example

Consider a UC step that says“The system generates a SQL INSERT statement for

the sale…”

What assumptions does the UC make?

How might those assumptions limit you?

How can you prevent customersfrom accidentally imposingthese sorts of unnecessary

requirements?

Page 29: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Guideline: Use black-box style

• Do not describe internal workings of system• Say what the system does, not how it does it• Think of system in terms of its responsibilities

Page 30: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

How might you word this step using black box?

• The system generates a SQL INSERT statement for the sale…

Page 31: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

How might you word this step using black box?

• The system generates a SQL INSERT statement for the sale…

• Like this: The system records the sale.

Page 32: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Consider this motivating quote

“the software industry is littered with failed projectsthat did not deliver what people really needed”

— Larman

How can we make sure we deliver what our customers really need?

Page 33: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Guideline: Actor and actor-goal perspective

• Write requirements focusing on the users (actors) of a system, asking about their goals and typical situations– Look for different types of users

• Focus on understanding what the actor considers a valuable result

Page 34: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

We know that the customers have difficulty effectively communicating requirements

How can we discover requirements thatthe customer might not think to tell us about?

Page 35: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

Guideline for finding requirements

• Ask probing questions that focus on:– The primary actors and their goals– The system boundary

• Prototyping and other activities

Page 36: This section has been adapted from Dr. Scott Fleming of U. Memphis Details about Use Cases

The System Mobile/webcustomer

Such probing might producea helpful diagram like this

Phone system

Phonesupport

Servicetech

Phonecustomer

Bicyclestations