Writing Effective User Stories For Agile Requirements: Mike Cohn September 26, 2005
Writing Effective User Stories For Agile Requirements: Mike Cohn September 26, 2005
Writing Effective User Stories For Agile Requirements: Mike Cohn September 26, 2005
Mike Cohn
September 26, 2005
Mike Cohn—background
Programming for 20 years
Author of
User Stories Applied
Agile Estimating and Planning
Java, C++, database programming
books
Founding member and director
of the Agile Alliance and the
Scrum Alliance
Founder of Mountain Goat
Software
Process and project management
consulting and training
1
Today’s agenda
What user stories are
Users and user roles
Gathering stories
INVEST in good stories
Why user stories?
2
Samples – Travel reservation system
As a vacation planner, I
As a user, I can reserve a
can see photos of the
hotel room.
hotels.
3
Details added in smaller “sub-stories”
As a premium site
member, I can
cancel a reservation
up to the last minute.
4
Today’s agenda
What user stories are
Users and user roles
Gathering stories
INVEST in good stories
Why user stories?
“The User”
Many projects mistakenly assume there’s
only one user:
“The user”
Write all stories from one user’s
perspective
Assume all users have the same goals
Leads to missing stories
5
Travel Site—Who’s the user?
Mary Laura
Frequent flier who Wants to schedule
never knows where her family’s annual
she’ll be Jim vacation
Frequent flier who
flies every week but
always to the same
place
Howard Dominic
Mary’s assistant; Hotel chain Vice
books her President; wants to
reservations monitor reservations
User roles
Broaden the scope from looking at one user
Allows users to vary by
What they use the software for
How they use the software
Background
Familiarity with the software / computers
Used extensively in usage-centered design
Definition
A user role is a collection of defining attributes that
characterize a population of users and their intended
interactions with the system. Source: Software for Use by
Constantine and Lockw ood (1999).
6
Common attributes Infrequent
Vacation Planner
Mary Laura
Frequent flier who Frequent Flier Wants to schedule
never knows where her family’s annual
she’ll be Jim vacation
Frequent flier who
flies every week but
Repeat
always to Traveler
the same
Scheduler Insider
place
Howard Dominic
Mary’s assistant; Hotel chain Vice
books her President; wants to
reservations monitor reservations
7
User role brainstorming
8
Organize the initial set
Arrange cards spatially to indicate
overlapping and similar roles
Use any arrangement rules you want
College grad Job poster Resume
First timer reader
Layoff victim Recruiter
Geographic
searcher
Job seeker
Monitor Sys Admin
Consolidate roles
Discuss what is meant by each card
Arrange cards spatially to indicate
overlapping and similar roles
Use any arrangement rules you want
Look for cards to
Combine
Replace with a more generic/different card
Eliminate cards that are unimportant to
the success of the product
All slides copyright 2000-2005, Mountain Goat Software
18 Slides copyright 2000-2004, Michael W. Cohn
9
Consolidating–an example
College
Job seeker Job poster Resume
grad
First timer reader
Layoff Recruiter
First timer Internal
victim
Geographic recruiter
searcher
Layoff External
Job seeker
victim recruiter
Monitor Sys Admin
Geographic
searcher
10
Advantages of using roles
Start thinking of software
Users become
as solving needs of real
tangible
people.
Today’s agenda
What user stories are
Users and user roles
Gathering stories
INVEST in good stories
Why user stories?
11
Gathering stories
Common metaphors for requirements are
wrong
“Eliciting
requirements”
“Capturing requirements”
†
Mastering the Requirements Process
by Suzanne and James Robertson,
1999.
12
A little is enough, or is it?
Agile processes acknowledge that we
cannot trawl with such a fine net that we
can write all the user stories upfront
However,
This
doesn’t mean we shouldn’t write as
many as we can
Questionnaires
Observation
User interviews
Story-writing
workshops
13
Questionnaires
Good technique for learning more about
stories you already have
If you have a large user base, great way
to get information to help prioritize stories
Not effective as a primary means of
trawling for new stories
Observation
Great way to pick up insights
Two approaches
Justobserve, with or without user’s
knowledge
Have the user demonstrate to a group how
she uses the software
14
Observation example
Stated need:
“We need a large text field to summarize.”
Observed need:
Have the system record the user’s choices
Interviews
Default approach taken by many teams
Selection of interviewees is critical
Tryto interview as many user roles as
possible
Cannot just ask “So whaddaya want?”
Most users are not adept at understanding
their true needs
15
Context matters
“He’s no longer
with us…”
“Dad,
make it
warmer.”
16
A horrible question
This question sucked two years out of my
life
We can do better
“What would you think of having this app in a
browser rather than as a native Windows
application even if it means reduced
performance, a poorer overall user experience,
and less interactivity?”
It’s open
Full range of answers
But it has too much context
17
The best way to ask
Beware of assumptions
What time did the sun rise in Boston, MA,
on October 10, 1582?
Draw a single line that crosses each line
segment in this figure exactly once:
18
Seeking a solution
19
We need to stop asking users
Since users don’t know how to solve their
problems, we need to stop asking
We need to involve them instead
Story-writing workshops
Includes developers, users, customer,
others
Goal is to write as many stories as
possible
No prioritization at this point
Uses low-fidelity prototyping and
brainstorming techniques
20
Start with epics and iterate
As a frequent flyer,
As a frequent flyer, I want to book a
I want to see trip using miles.
check my account.
As a frequent flyer,
I want to re-book a
As a frequent flyer, trip I make often.
Frequent
I want to book a
Flyer trip. As a frequent flyer,
I want to request
an upgrade.
A low-fidelity prototype
News
21
Low-fidelity prototyping
Use paper, note cards, white board, big Post-
its
Prototype is of components or areas within
the application, not of actual screens
HotelResults could be on Home Page or be a
separate page
Doesn’t require knowledge of how screens
will look
Throw it away a day or two later
Works better to go depth-first
All slides copyright 2000-2005, Mountain Goat Software
43 Slides copyright 2000-2004, Michael W. Cohn
22
A mini story-writing workshop
Today’s agenda
What user stories are
Users and user roles
Gathering stories
INVEST in good stories
Why user stories?
23
What makes a good story?
Independent
Negotiable
INVEST Valuable
Estimatable
Small
Testable
Thanks to Bill Wake for the
acronym. See www.xp123.com.
Independent
Avoid introducing dependencies
Leads to difficulty prioritizing and planning
A company can pay
for a job posting with
The first of these
a Visa card.
stories will take 3 days
A company can pay
? for a job posting with to develop
an AmEx card. It doesn’t matter
A company can pay which is first
for a job posting
? with The others will take 1
a MasterCard. day
?
All slides copyright 2000-2005, Mountain Goat Software
48 Slides copyright 2000-2004, Michael W. Cohn
24
Making stories independent
Combine the stories A customer can pay with a credit card.
Negotiable
Stories are not
Written contracts
Requirements the software must fulfill
Do not need to include all details
Too many details give the impressions of
false precision or completeness
that there’s no need to talk further
Need some flexibility so that we can adjust how
much of the story gets implemented
If the card is contract then it needs to be estimated
like a contract
25
Is this story negotiable?
Print dialog allows the user to edit the
printer list. The user can add or remove
printers from the printer list. The user can
add printers either by auto-search or
manually specifying the printer DNS name
or IP address. An advanced search option
also allows the user to restrict his search
within specified IP addresses and subnet
range.
Valuable
Stories must be valuable to either:
As a user, I can search for a job by title
Users and salary range.
26
Stories valued by developers
Should be rewritten to show the benefit
Up to 50 users should
All connections to the
be able to use the
database are through
application with a five-
a connection pool.
user database license.
Estimatable
Because stories are used in planning
A story may not be estimatable if:
Developers lack As a new user, I am given a
domain knowledge diabetic screening.
27
Small
Large stories (epics) are
hard to estimate
hard to plan
They don’t fit well into single iterations
Compound story
An epic that comprises multiple shorter stories
Complex story
A story that is inherently large and cannot easily be
disaggregated into constituent stories
Compound stories
Often hide a great number of assumptions
A resume includes separate
sections for education, prior
jobs, salary history,
publications, etc.
As a user, I can Users can mark resumes as
post my resume. inactive
Users can have multiple
resumes
Users can edit resumes
Users can delete resumes
All slides copyright 2000-2005, Mountain Goat Software
56 Slides copyright 2000-2004, Michael W. Cohn
28
Splitting a compound story
Split along operational
boundaries (CRUD)
29
Other ways to split large stories
Remove cross-cutting concerns
Don’t meet performance targets
Avoid splitting stories into tasks
Avoid the temptation of related changes
Testable
Tests demonstrate that a story meets the
customer’s expectations
Strive for 90+% automation
As a novice user, I am
A user must find
able to complete
the software easy
common workflows
to use.
without training.
A user must
New screens appear
never have to
within 2 seconds in
wait long for a
95% of all cases.
screen to appear.
All slides copyright 2000-2005, Mountain Goat Software
60 Slides copyright 2000-2004, Michael W. Cohn
30
Fixing stories
1) Assess the stories you’ve written for
fBay against the INVEST attributes.
2) Rewrite those that are do not meet
these criteria.
3) If you can’t figure out how to rewrite a
story, save it for class discussion.
Independent Estimatable
Negotiable Small
Valuable Testable
All slides copyright 2000-2005, Mountain Goat Software
61 Slides copyright 2000-2004, Michael W. Cohn
31
Today’s agenda
What user stories are
Users and user roles
Gathering stories
INVEST in good stories
Why user stories?
32
Actual examples
Must the user enter a
The user can enter a
name?
name. It can be 127
Can it be other than 127
characters.
chars?
Additional reasons
Stories are comprehensible
Developers and customers understand them
People are better able to remember events if
they are organized into stories†
Stories are the right size for planning
Support and encourage iterative
development
Can easily start with epics and disaggregate
closer to development time †
Bow er, Black, and Turner. 1979.
Scripts in Memory for Text.
33
Yet more reasons
Stories support opportunistic development
We design solutions by moving opportunistically
between top-down and bottom-up approaches†
Stories support participatory design
Participatory design
The users of the system become part of the team designing
the behavior of the system
Empirical design
Designers of the new system make decisions by studying
prospective users in typical situations
†
Guindon. 1990. Designing
the Design Process.
Most importantly…
Don’t forget the
purpose
34
Mike Cohn contact information
mike@mountaingoatsoftware.com
(303) 810–2190 (mobile)
(720) 890–6110 (office)
www.mountaingoatsoftware.com
35