Title: OOA2'1
1Use Cases and Scenarios
- Sources
- "Object Models", Peter Coad
- "Object-Oriented Software Engineering", Ivar
Jacobson - UML Distilled, Martin Fowler
2Product Mapping
Functional Requirement
Data Requirement
Use Case
helps id
breaks down into one or more
mapped to
helps id
mapped to
Use Case Path
ids
Domain Class
used to implement
Concrete Analysis Scenario
Event Trace
tested by
Class Design
ids details for
used to implement
Concrete Design Scenario
Message Trace
tested by
Code
ids context for
3Defining System Purpose and Features
- Brief statement of the system purpose (25 words
or less) - Why this system
- Why now
- List of Features
- Types
- Log important information
- Conduct business
- Analyze business results
- Interact with other systems
- Identify best and worst features of comparable
systems - Prioritize
- Concentrate on the top 10
4Example Small Library SystemPurpose and Features
- The purpose of the Library System is to assist
borrowers using the library and the library
managing check-out and check-in of media items. - Specific features of the Library System will
include - maintain a catalog of all media items to assist
locating information - maintain a history of checked-out media items for
a borrower and for a media topic - maintain a history of media checked-in and out,
per media topic and borrower - produce late notifications and fines for over-due
media
5Defining Use Cases
- Actors - what exists outside the system
- Actor term used by Jacobson and Rumbaugh. Maps
more to Coad's "Participant". - Use Cases - what should be performed by the
system
6Actors (External "Participants"/"Roles")
- Roles played by prospective users of the system
- Models anything that needs to exchange
information with the system - Can be a person
- Can be a communicating system
- An external object can play the role of one or
more different actors
7Use Cases
- Defines the functionality within the system
- Complete course of events between the actor and
the system - Locating Use Cases
- What are the main tasks of each actor?
- Will the actor have to read/write/modify system
information? - Will the actor have to input outside information?
- Does the actor wish to be informed about
unexpected changes? - Samples
- Locate Media
- Add Media
- Check-out Media
- Check-in Media
- Remove Media
- Add New Borrowers
- Remove Borrowers
- Issue Overdue Notices
- Pay Fines
8Defining Use Cases
- Start with identification and then add details
- Use Cases are made up of one basic course and
several alternate courses - Basic Course - most important course for a use
case - Alternate Courses - variants to the basic course
for special error conditions - Add details to the alternate courses only after
model stabilizes - Add details independently with relation to time
9Example Use Case Locate Media
- Primary Path (Media Located) The librarian and
borrower (researchers) will both search for media
topics in the library through a computer display.
The topics can be located by type, title, author,
keywords in the description as well as specific
media type selections (ex software format). The
results of the search are displayed to the
researcher in summary format. The detailed
descriptions of each media topic can then be
displayed as well as printed. - Alternate Path (Media not Located) The system
does not locate the media. The researcher is
informed of this result and can then edit the
previous query or cancel the request.
10Example Use Case Add Media
- Primary Path (Add Media for New Topic) The
librarian will interact with a computer display
to enter in a new media topic and copy. The
librarian will enter the title, author, and
description for the media topic and serial
numbers for each new copy. The librarian will
also be able to enter the following information
for specific types of media topic - Books pages
- Software format and version
- Video Tapes format and rating
- The new media is entered into the library
system and is now available for borrowers to
search for and check-out. - Alternate Path (Add Media for Existing Topic)
The librarian will search for the media topic by
title and author and add the new serial numbers
for the additional copies.
11Defining Use Case Relationships
- Uses
- extracted common behavior
- breakdown of complex behavior
- Extends
- additional sub-course of events
- complex alternate path
12Library Use Case Model (Jacobson)
13Library Use Case Model (UML)
Issue Late Notices
ltltextendsgtgt
Add Borrowers
ltltextendsgtgt
Update Borrowers
External Librarian
Remove Borrowers
ltltextendsgtgt
ltltextendsgtgt
ltltextendsgtgt
Credit Payments
Checkout Media
Checkin Media
ltltextendsgtgt
ltltextendsgtgt
ltltextendsgtgt
Update Media
ltltextendsgtgt
ltltusesgtgt
Add Media
External Browser
Locate Media
Remove Media
14Demonstrating Coverage with Scenarios
- Scenarios
- UML Model
- Sequence Diagram
- Collaboration Diagram
- Content
- Analysis Events (Event Trace)
- Detailed Design Methods (Method Trace)
- Method
- Select Key Use Case Paths
- Start with Problem Domain
- Work backwards to Human Interaction
- Work forwards to (external) System Interfaces
- Add Data Management where necessary
- Act out interactions
15Sequence Diagram Event Trace
objects
time
OutputDevice
Device Player
External Listener
1 Initialize ( )
Message
2 Play ( )
3 Audio ( )
4 Terminate ( )
Return Message (optional)
Activation (focus of control)
Label
16Scenario Add Media Topic
- The librarian will add a new book to the library
by creating a new book media topic through a card
catalog window. In creating the media copy
(book), the librarian will supply parameters of
title, description, author, and pages. An
existing topic is searched for in the existing
topics. The successful addition is reported to
the librarian. The librarian can then add a new
media copy for each copy of the book (refer to
Add New MediaCopy).
17Scenario Add Media Copy
- The librarian first requests the media topic from
the card catalog window. A set of search criteria
is filled in and used to locate the media topic
in the card catalog. Once found, the media topic
can have many operations performed on it. In this
instance, the librarian requests that a new copy
be added. The librarian will supply a bar code
for the new copy. The media topic adds the new
copy and the librarian is informed of the
successful completion.
18Some Points
- Don't ask an object what type it is - let the
object worry about its kind - Search for an object and then interact with it -
simplifies intervening objects - suggests interacting with desired object rather
than cascading messages - Allow sensing objects act rather that poll for
status - Events in a scenario must match class model
- Simplify complex or multiple event interactions
- Limited detail/concern (defer to design)
- creation and deletion of objects
- locating objects
19Allocating Requirements
- System/Software Requirements
- Extract Essential Details
- Allocation
- Static Requirements - Subsystem/Domain Class
- Functional Requirements - Use Case/Use Case Path
- Design Requirements
- Between subsystems or organizations
- Allocation
- Static Requirements - Unit/Design Class
- Functional Requirements - Event Trace