lecture-04-usecases (3)
lecture-04-usecases (3)
Reading:
Writing Effective Use Cases, A. Cockburn (alistair.cockburn.us/get/2465) – MUST
READ (Examples)
http://www.cragsystems.co.uk/use_case_tutorial/ == Recommended
Ian Summorvillie, Software Engineering, Chapter 4 (Further Reading)
Outline
• What is a use case?
• Terminology
2
Functional Req
– Functional Requirement is a verb, while Non-
Functional Requirement is an attribute
– transaction corrections, adjustments, and
cancellations
– Reporting Requirements
– Administrative functions, Authorization levels, Audit
Tracking,
– External Interfaces, Historical Data management,
Legal or Regulatory Requirements are various types
of functional requirements.
3
Non Functional Req
Basically deal with issues like:
• Portability
• Security
• Maintainability
• Reliability
• Scalability
• Performance
• Reusability
• Flexibility
4
Use cases
• Functional Requirements
– Tell us what the user will do with the system.
– Not enough details for developers
– Need a way to describe the sequence of interactions
to accomplish a functional requirement.
• use case: a written description of the user's
interaction with the software product to
accomplish a goal
– It is an example behavior of the system.
• clearly written steps lead to a "main success scenario"
• written from actor's point of view, not the system's
6
Qualities of a good use
case
• Focuses on interaction
– Starts with a request from an actor to the system.
– Ends with the production of all the answers to the
request.
8
Use cases and
requirements
• Which of these requirements would probably be
represented or mentioned directly in a use case?
1. Special deals may not run longer than 6 months.
2. Customers only become preferred after 1 year.
3. A customer has one and only one sales contact.
4. Database response time is less than 2 seconds.
5. Web site uptime requirement is 99.8%.
6. Number of simultaneous users will be 200 max.
• Answer: None!
– Most of these are non-functional requirements, so the use
cases wouldn't mention them.
– The user doesn't see them directly.
9
Terminology
• actor: an entity that acts on the system
– primary actor: initiates interaction to achieve goal
– supporting actor: performs sub-goals in use case
11
Styles of use cases
1. Use case diagram
– shows all use cases in system
– In UML (Unified Modelling Language – a famous design
language)
12
1. Use case diagram
• The overall list of the system's use cases can be drawn
as high-level diagrams, with:
– actors as stick-men, with their names (nouns)
– use cases as ellipses, with their names (verb phrases)
– line associations, connecting an actor to a use case in
which that actor participates
– use cases can be connected to other cases that they use /
rely on
• E.g Check out book depends on login
13
Actor-goal lists: function
content of the system
Actor Goal
Library Patron Search for a book It can be useful to
Check out a book create a list or table
of primary actors and
Return a book
their "goals" (use
Librarian Search for a book cases they start).
Check availability
Request a book from The diagram will
another library then capture this
material
14
Use case summary
diagrams
15
<<includes>>
relationship
18
2. Informal use case
• informal use case: a paragraph describing the
scenario
• Example (for a library management system):
19
Informal use case with
structured text
• I
– I.A
• I.A.ii You will probably use
– I.A.ii.3 something in this
» I.A.ii.3.q general style.
20
What is an extension?
• A possible branch in a use case scenario, often
triggered by an error or failure in the process.
– Useful for finding edge cases that need to be handled and
tested.
• Do
– Think about how every step of the use case could fail.
– Give a plausible response to each extension from the
system.
– Response should either jump to another step of the case,
or end it.
• Don’t
– List things outside the use case ("User's power goes out").
– Make unreasonable assumptions ("DB will never fail").
– List a remedy that your system can't actually implement.21
Formal Use case
23
3. Formal use case
(goal of primary actor) (level of goal [summary, user, subfunction])
(primary actor)
"Place an order" (User goal / Clerk)
(action steps:
full sentences showing
Main scenario: who takes the action!
1. Clerk specifies customer, item and3quantity.
- 9 steps long.)
2. System accepts and queues the order.
...
(condition causing different actions)
Extensions: (action step(s)
1a. Low credit & Customer is 'Preferred':
handling those conditions)
1a1. System gives them credit anyway.
1b. Low credit & not 'Preferred' customer:
1b1. Clerk performs Sign Up Preferred
Customer scenario and accepts only prepayment.
2a. Low on stock: Customer accepts rain-check:
(calling another use case)
2a1. Clerk reduces order to available stock
level. 24
Use case exercise
• Consider a Netflix-like video rental web system.
– A customer with an account can use their membership
and credit card in the web app to order a video for rental.
– The software can look up movies and actors by keywords.
– A customer can check out up to 3 movies, for 5 days
each.
– Late fees can be paid at the time of return or at next
checkout.
• Exercise:
– Come up with 3-4 use case names for this software.
– Identify some of the actors and stakeholders in this
system.
25
Solution
26
What notation is good?
• There are standard templates for requirements
documents, diagrams, etc. with specific rules.
• Is this a good thing? Should we use these standards or
make up our own?
– Standards are helpful as a template or starting point.
– But don't be a slave to formal rules or use a
model/scheme that doesn't fit your project's needs.
27
Cockburn's 4 use case
steps
1. Identify actors and goals
– What computers, subsystems, people
will drive our system? (actors)
– What does each actor need our
system to do? (goals)
28
Cockburn's 4 use case
steps
3. List the failure extensions
– usually almost every step can fail (bad credit, out of
stock...)
• note failure condition separately, after main success
scenario
– Describe failure-handling
• recoverable: back to main course (low stock + reduce
quantity)
• non-recoverable: fails (out of stock, or not a valued
customer)
• each scenario goes from trigger to completion
– Label with step number and letter:
• 5a failure condition
– 5a.1 use case continued with failure scenario
– 5a.2 continued
29
Cockburn's 4 use case
steps
• 4. List the variations
– Many steps can have alternative behaviors or scenarios
– Label with step number and alternative
• 5’. Alternative 1 for step 5
• 5’’. Alternative 2 for step 5
30
Usability
• Usability: The effectiveness with which users can
accomplish tasks in a (software) system, as measured
by:
– Learnability: is it easy to learn?
– Efficiency: once learned, is it fast to use?
– Safety: are errors few and recoverable?
33
Achieving usability: Best
practices
• some methods to achieve good usability:
– user testing / field studies
• having users use the product and gathering data
– prototyping
• paper prototyping
• code prototyping
34
User Interface:
Prototyping
• prototyping: Creating a scaled-down or incomplete
version of a system to demonstrate or test its aspects.
35
Types of Prototyping
36
Some prototyping
methods
• UI builders
• draw a GUI visually by dragging/dropping UI controls on
screen
• Code prototyping
– Writing a "rough" version of your code
37
Why paper prototyping?
• Question: Why not just code up a working
code prototype?
– much faster to create and change than
code
– more visual bandwidth (can see more at
once)
– more conducive to working in teams
– can be done by non-technical people
38
When to do (paper)
prototyping?
• Question. Requirements are the what and
design is the how. Which is paper prototyping?
• Answer. Prototyping
– helps uncover requirements and upcoming
design issues
– during or after requirements but before design
– shows us what is in the UI, but also shows us
details of how the user can achieve goals in
the UI
– Included as a requirements artifact to initially envision the
system
39
Paper prototype usability
testing
• user is given tasks to perform using paper prototype
• Facilitator guides the user through tasks, prompting for
feedback.
• session can be observed by people or camera
• one developer can "play computer"
“Computer” Facilitator
Observer(s)
User
40
Schneiderman's 8 Golden
Rules
• Strive for consistency. • Offer simple error
• Give shortcuts to expert handling.
user. • Permit easy undo of
• Offer informative actions.
feedback. • Let the user be in control.
• Make each interaction • Reduce short-term
with the user yield a memory load on the user.
result.
p://faculty.washington.edu/jtenenbg/courses/360/f04/sessions/schneidermanGoldenRules.h
41
Bad error messages
42
UI Hall of Fame
Reading Assignment :
• Read about UI hall of fame/shame
43
UI design: components
• When to use:
– A button?
– A check box?
– A radio button?
– A text field?
– A list?
– A combo box?
– A menu?
– A dialog box?
– Other..?
44
UI design - buttons, toolbars,
menus
• Use buttons for single independent actions that are
relevant to the current screen.
– Use button text with verb phrases such as
"Save" or "Cancel", not generic: "OK", "Yes",
"No"
– use Mnemonics or Accelerators (Ctrl-S)
46
Lists, combo boxes, etc.
• use text fields (usually with a label)
when the user may type in anything
they want
– you will usually have to validate the
input
Phrase:
Default
Cancel
OK
49
Creating a paper
prototype
• gather materials
– paper, pencils/pens
– tape, scissors
– highlighters, transparencies
50
Application backgrounds
• draw the app background (the parts that matter for the
prototyping) on its own, then lay the various
subscreens on top
51
Interactive widgets
widget how to simulate it
buttons or check tape
boxes
tabs and dialog index cards or small
boxes papers
text fields removable tape
combo boxes put the expanded
choices on a separate
paper / Post-It
selections highlighted piece of tape
a disabled widget cut out a separate gray
version that can be
placed on top of the
normal one
52
Example paper prot.
screen
53
Summary
• Uses case describe example system behaviors
(contracts) from the user’s point of view.
54
• Tasks
1, Finishing up functional and non functional requirement
2, develop use case for your specific system on paper
3, sketch your user interface.
55