Capturing and Exploring Requirements with Use Cases and UML

Download Report

Transcript Capturing and Exploring Requirements with Use Cases and UML

Capturing and Exploring Requirements
with
Use Cases and UML Models
Eddie Burris
UMKC
Writing Use Cases–Motivation
• Writing use cases supports requirements
activities:
– Method of recording functional requirements.
– Readable by end users but also detailed enough
for programmers to implement and testers to
write test cases.
– Systematic and semi-formal representation
helps ensure requirements are complete and
well understood.
Visual Modeling–Motivation
• Models are visual. They are potentially a more
efficient and effective form of communication
than prose.
• Models are more precise. Hard to recognize
missing elements in written forms of
requirements. With a model, missing elements are
more noticeable.
• Models can represent ideas from different
perspectives.
• When to model? During requirements, design, and
post-implementation.
Use Case—Definition
• A use case is a narrative description of a
goal-oriented interaction between the system
under development and an external agent
• Includes (the what):
– User (Actor in Use Case Parlance)
– Goal
– Interaction
• Excludes (the how):
– User Interface Detail
– Implementation Concerns
Use Case Template
Title:
Actors:
Preconditions:
Postconditions:
Basic Flow / Main Success Scenario
Alternate Flow / Extensions
Open Issues
Example
Title:
Search Web with suggested key words
Actors:
Web User
Preconditions:
Web user is at the search page
(Google Suggest)
Basic Flow
1.
User begins to enter search phrase
2.
As characters of search phrase are typed, the system responds with suggested search phrases that start
with characters entered
3.
The system enters the highest ranking suggested search phrase into the search box where the user is
typing
4.
User scrolls to desired suggested phrase
5.
User initiates search
6.
System responds with search results that match search phrase
Alternate Flows
2a. There are no high ranking suggested search phrases for the characters the user has entered
1. The system gives no suggested search phrases
2. The user enters the remaining characters in the search phrase and control returns to step 5 in basic flow
4a. User decides to accept suggested search phrase in search box
1. User initiates search with suggested search phrase currently in search box
4b. User finishes entering original search phrase but doesn’t want to take system’s suggestion
1. User hits backspace to erase remaining suggested characters in search box
Open Issues
1. How to decide the order or ranking of suggested search phrases.
UML Use Case Diagrams
Newspaper Web Site
Post article
<<include>>
Journalist
System Under
Development
Authenticate user
<<include>>
Actor
Use Case
Generic Form
Find and
read article
Example
Reader
UML Diagram Types
• Static
– Class Diagrams
• Dynamic
– State Machine Diagrams
– Activity Diagrams
– Sequence Diagrams
UML Class Diagrams
Relationship
Class Name
Class Name
Attributes
Attributes
Operations
Operations
Generic Form
Student
is enrolled in
10..30
CourseOffering
*
semester
Example
*
1
Course
courseTitle
UML State Machine Diagram
Initial State
Final State
State
State
event [guard] action
Generic Form
Empty
[out of stock]
stock
enter money / update credit
Ready for
Business
select beverage /
reduce credit &&
dispense beverage &&
reduce stock
[credit > purchase price]
Ready to
Dispense
Example
Another State Machine Example
after (1 min)
Disconnected
Connection
Established
do/Attempt connection
Connected
Connection
Lost
Newly Disconnected
do/Attempt connection
Connection Established
Introducing Application
entry/audio intro
Waiting for Connection
do/play soothing music
after (2 min) / reassure user
[! disconnected] / announce connection
Waiting for Announceable building
do/look for next valid building
[disconnected] / announce disconnection
announceable building
Announcing Building
entry/ announce building
This was used to explore an existing use case.
Building announcement order
1closest building that hasn’t already
been announced.
2After all buildings within a certain
range have been announced you can
reannounce a building if it has been
12 minutes since it was last
announced or it has gone out of range
and back into range since it was last
announced.
UML Activity Diagram
...
[cond]
Activity
Transition
...
Branch
Generic Form
[cond]
Merge
UML Activity Diagram
Predefined condition [else]
evaluates to true if none of the
other branch conditions evaluate
to true.
User Requests
Web Page
[Web page requires
authorization]
[else]
[Session
established]
[Web page
doesn’t require
authorization]
[User has
authority to
access web
page]
Prompt for ID
and password
[Valid ID and
password]
User enters ID
and password
[User doesn’t
have
authority to
access web
page]
Issue
“not authorized”
Message
[Invalid ID
and/or
password]
Branch conditions may be
placed on a state as an
alternative to adding a branch
diamond.
A junction point can
be used to merge or
split transitions.
Show Web Page
Example
The End