Upload
xavier-bowes
View
229
Download
3
Tags:
Embed Size (px)
Citation preview
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 1
Agile Use Cases
( Writing Effective Use Casesmeets
Agile Software Development ! )
Alistair CockburnHumans and Technology
[email protected]://Alistair.Cockburn.us
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 2
Can use cases be agile? Yes(Can you be agile with use cases?) Yes
Do use cases contradict Agile ?: Use cases / not use cases / value of use cases vs stories: Agile / not agile / value of agile
When should we use agile use cases ?: document faster, later, cheaper, : plan on changing your mind along the way,: always.
Detecting and exercising available dimensions of freedom: Write less, more clearly (tips). : Shortcut process & use case structure ... (tips, tradeoffs): Tools
Q&A
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 3
Coming from agile non-use-cases to agile UCs is easier than coming from non-agile UCs
Overly complex use case writing is hard to change,tied to overly complex process (hard to change!)
Already understanding Agile means: already have a lighter process: already have mindset to simplify the writing: --> leads to agile use case writing.
Need to understand : (A) Simple use cases: (B) Agility as energy savings
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 4
Part 1:
What is / isn’ta
use case
(good for)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 5
Good use casesare aren’t
TextNo GUI
No data formats3 - 9 steps in main scenario
Easy to readAt user’s goal level
Record of decisions made
UML use case diagramsdescribing the GUIdescribing data formatsmultiple-page main scenariocomplicated to readat program-feature leveltutorial on the domain
Use cases *can be* written --all up front --or-- just-in-time
each to completion --or-- in (usable) increments
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 6
Use case: Text describing scenarios of user succeeding or failing to achieve goal.
“Place an order” (User goal / Clerk)
Main scenario:1. Clerk identifies customer, item and quantity. 2. System accepts and queues the order.
Extensions:1a. Low credit & Customer is ‘Preferred’:
System gives them credit anyway.
1b. Low credit & not ‘Preferred’ customer: Clerk accepts only prepayment.
2a. Low on stock: Customer accepts rain-check:Clerk reduces order to available stock level.
(goal of primary actory) (level of goal [summary, user, subfunction])
(action steps: full sentences showing who takes the action! 3 - 9 steps long.)
(condition causing different actions)
(action step(s) handling those conditions)
(primary actor)
Robert Martin: “It shouldn’t take longer than 15 minutes to teach someone how to write a use case!”
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 7
Good use casesare aren’t
TextNo GUI
No data formats3 - 9 steps in main scenario
Easy to readAt user’s goal level
Record of decisions made
UML use case diagramsdescribing the GUIdescribing data formatsmultiple-page main scenariocomplicated to readat program-feature leveltutorial on the domain
Use cases *can be* written --just-in-time --or-- all up front
in (usable) increments --or-- each to completion
(more Agile) (more common)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 8
Use cases summarize end-user experience, not programmers tasks.
1980’s: Let’s write requirements in features!: User’s don’t understand...
...user pressure to write in use cases...
1990’s: Let’s write requirements in use cases!: Programmers’ work units are features, not use cases...
...programmer pressure to write in features...
2000: So let’s write requirements in features!: FDD & XP user stories...
...lose the end user experience again ...
A pendulum of features vs. use cases
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 9
1. Use cases hold functional requirements in an easy-to-read text format
2. They make a good framework for non-functional requirements & project scheduling.
3. Use cases show only the Functional req’ts.
4. Design is not done only in use case units.
Use cases have strong & weak points(as anything)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 10
Use cases do not collect formulae, state, cardinality, performance, uptime, ...
Examples:1. Order cost = order item costs * 1.06 tax2. Promotions may not run longer than 6 months.3. Customers only become Preferred after 1 year.4. A customer has one and only one sales contact.5. Response time is less than 2 seconds.6. Uptime requirement is 99.8%.7. Number of simultaneous users will be 200 max.
Capture those in any form available,*somewhere* in your requirements files !
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 11
Goals make a good structure on which to hang requirements & project details.
Project planning capitalizes on goal structure:: Useable Releases.: Priorities, : Schedule, staffing
Name P. Actor Pr. Diff. ReleaseUpdate customer Customer high med 1Scan products Customer high high 1Generate invoice Finance high high 3Funds transfer Finance med high 4
(Note: spreadsheets are perfect for this!)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 12
Use cases provide 4 values to the project at different times:
1. The list of goal names provides executives:: Shortest summary of what system will contribute: Project planning skeleton (priorities & timing)
2. The main success scenario provides all:: Agreement as to the system’s responsibilities
3. The extension conditions provide programmers:: List of things programmers have to watch for: List of things analysts have to investigate
4. The extension handling steps provide dev’t team:: Record of (tricky) business policy decisions
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 13
The hard parts about use cases is not typing,but thinking and agreeing.
• Total time: ~ 3 days construction : ~ 2 hours typing : 2-3/4 days spent thinking, arguing (over policy).
1. Is each step correct?2. Are there any system responsibilities between steps?3. Are there any outside systems this system should use?4. Are there any other stakeholders whose interests we
missed?5. Did we catch every extension condition?
(The programmers will (maybe))
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 14
Don’t try to teach a tutorial on the subject domain within the use cases!
In any text, receiver must always jump a gap.: Experts jump larger gaps: Novices jump smaller gaps.
To teach a domain, you need a textbook, not use cases.: Textbooks use smaller gaps.: Think of use cases as “documenting decisions”,
not “teaching the domain.”
Target the gap for the people: “sufficient” communication with a “small-enough”gap.: More experienced people need less writing !
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 15
Part 2:
What is / isn’tagile
development
(good for)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 16
History: How did “agile” arise?
“Agile” techniques were in use since the beginning.
Agile (mobility-based) techniques did not show competitive advantage in the 1970s / 1980s,but did during the 1990s and do now.
1994: trials of semi-formal agile methodologiesRAD DSDM XP Crystal Scrum Adaptive
(3-1/2)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 17
Development approaches are only attitudes, “centering of the attention”.
Declarations of core values declare an “attitude”
An attitude cannot promise success in the future,it can only be spoken successfully in the past tense. it is only a wish to be a certain way
A would-be agile processA would-be predictable processA would-be repeatable processA would-be inexpensive process
(4-1/2)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 18
2001 Agile Software Development Manifesto - a declaration of values
“We are uncovering better ways of developing software by doing it and helping others do it.
Through this work we have come to value:: Individuals and interactions over Processes and Tools.: Working software over Comprehensive documentation.: Customer collaboration over Contract negotiation.: Responding to change over Following a plan.
That is, while there is value in the items on the right, we value the items on the left more.”
(Kent Beck, Mike Beedle, Arie van Bennekum, Alistair Cockburn,Ward Cunningham, Martin Fowler, James Grenning, Jim Highsmith,Andrew Hunt, Ron Jeffries, Jon Kern, Brian Marick, Robert Martin,Stephen J. Mellor, Ken Schwaber, Jeff Sutherland, Dave Thomas )
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 19
Agile development works because software development is an economic game
Economic consequences to each choice.: Less is usually better... “sufficient” is enough.
(Project success factors reviewed:)
Nourishment
Skills
CitizenshipCommunication
FocusIncrements
(Agility resides Here!)
(Includes developers AND users!)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 20
Agile = shortcutting the process (cheating legally to win)
Scope
Time Resources
Process
(Some people use agile to handle late-breaking requirements changes, I use it to improve development efficiency)
Scope
Time Resources
The “iron triangle” isn’t a triangle at all --“Process” is the 4th dimension !
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 21
Agile development: short circuiting process steps without compromising final product.
• Focus on *early* & *frequent* delivery of *useful* software to real users using *just-in-time* techniques.
• Focus on *feedback* loops at all levels : (requirements design code test communication . . . )
• Replace fanfare around the process with people checking in with other people.
• *Talk* to users / sponsors, find out what they need!
• Adjust your working habits *monthly or quarterly* to fit your particular situation!
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 22
The Agile attitude focuses on:
1. Talent & Skill (fewer better people)2. Proximity (developers - developers - users)3. Communication (morale, daily standup)4. Just-in-time requirements and design5. Frequent Delivery (incremental development)6. Reflection7. Less paper, more tacit / verbal communication8. Tools9. Quality in work10. Different strategies for different projects
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 23
Agility *can*Be heavier or lighter, depending on circumstances
Use various requirements techniques (e.g., use cases, stories, features)
In agile development we valuefollowing the principles over following specific practices !
Good agile developmentis / does isn’t / doesn’t
EfficientLots of “just in time”
Adjust to circumstances(Re)Plan regularly
Lots of person-to-person comm.Adaptively cut fat in the process
hackingGiant Energy Up Front (GEUF)only XP (XP is one alternate)plan-lessPeople sitting in isolationrigid adherence
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 24
Is / Isn’t: Misconstruing the message
1. Agile SD is cheating
2. Agile SD requires the best developers
3. Agile SD is hacking
4. Agile SD won’t work for all projects
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 25
1. Agile techniques are “cheating”.
· Hire good people;· Seat them close together to help each other out;· Get them close to the customers and users;· Arrange for rapid feedback on decisions;· Let them find fast ways to document their work;· Cut out the bureaucracy.
This is: cheating stacking the decka good idea
the heart of agile software development
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 26
2. Agile only works with the best developers.
Every project needs at least one experienced and competent lead person. (Critical Success Factor)
Each experienced and competent person on the team permits the presence of 4-5 “average” or learning people.
With that skill mix, agile techniques have been shown to work many times.
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 27
3. Agile is hacking. (Hacker interpretations are inevitable.)
Hackers: “...spend all their time coding”Agilists: ...test according to project priorities,
recheck results with users often.
Hackers: “...talk to each other when they are stuck”Agilists: ...talk to each other and customers as
a matter of practice.
Hackers: “...avoid planning”Agilists: ...plan regularly
Hackers: “...management caves in out of fear”Agilists: ...expect management to provide priorities,
& participate jointly project adjustments.
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 28
4. Agile won’t work for all projects.
Right. (Business isn’t fair).
Agile is an attitude prioritizing: Project evaluation based on delivered code Rapid feedbackPeople as a value center Creativity in overcoming obstacles
Not every team ... values the Agile value set.... can set up the needed trust and communication
(5-6/6)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 29
Problem Size
Light methodology
Heavymethodology
# people needed
Lighter-agile vs. Heavier-agile :Light is good, but has limits
fewer people
more people
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 30
Number of people involved
C
riti
cali
ty(d
efec
ts c
ause
loss
of.
..)
Comfort(C)
Essentialmoney
(E)
Life(L)
+20%
. . . Prioritized for Legal Liability
1 - 6 - 20 - 40 - 100 - 200 - 500 - 1,000
C6 C20 C40 C100 C200 C500 C1000
D6 D20 D40 D100 D200 D500 D1000
E6 E20 E40 E100 E200 E500 E1000
L6 L20 L40 L100 L200 L500 L1000
Prioritized for Productivity & Tolerance
Discretionarymoney
(D)
Suit the process to the occasion project size & priorities, system criticality
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 31
Group’s tolerance for ambiguity / uncertainty
Pro
du
ctiv
ity:
(F
lux
& U
nce
rtai
nty
)Reality Check: Work as parallel & light as project features and personalites permit.
e-projects
old-schoolprojects
Project requires at least this muchproductivity to succeed
Where is your group,your projecton this graph??
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 32
Part 3:
Agile-ly generatingagile use cases
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 33
Core elements to using use cases *agile-ly* increments, just-in-time, close communication
• Write just enough use case content to plan to the needed planning horizon: Long (project) horizon -> just use case names or briefs.: Short (iteration) horizon -> extension handling.
• Just barely beat the programmers to the extension handling decisions (just in time)
• Write just enough content for the team to understand.
• *Show* UCs, system to users/sponsors, get feedback!
• Adjust your working habits *each iteration* to fit your particular situation!
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 34
Core elements to using use cases *agile-ly*:increments, just-in-time, close communication
Ask, • How much do we need to write at this time?• When do we need to write more?• What is the fastest way to write/convey them?• Who benefits from more information or more detail?
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 35
Take advantage of available degrees of freedom in the process
1. Write less more clearly (always)
2. Write less (sometimes)
3. Shortcut the use case structure (sometimes)
4. Write later & shortcut the process (usually)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 36
1. Write less more clearly (always)
TextNo GUI
No data formats3 - 9 steps in main scenario
Easy to readAt user’s goal level
Record of decisions made
UML use case diagramsdescribing the GUIdescribing data formatsmultiple-page main scenariocomplicated to readat program-feature leveltutorial on the domain
(shorter, more economic& more readable!)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 37
2. Write less (sometimes)(the economics of communication)
• Fully dressed use cases• Casual use cases• Use case briefs
The correct form to use depends on your project’s priorities and properties !
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 38
Economics of communication: Fully Dressed (expensive, complete)
Use Case 12. Buy stocks over the web Primary Actor: Purchaser (user) Scope: PAF
Level: user goal Precondition: User already has PAF open.
Guarantees: sufficient log information exists that PAF can detect what went wrong.
Success Guarantees: remote web site acknowledged purchase, user's portfolio updated.
Main success scenario:
1. User selects to buy stocks over the web.
2. PAF gets name of web site to use (E*Trade, Schwabb, etc.)
3. PAF opens web connection to the site, retaining control.
4. User browses and buys stock from the web site.
5. PAF intercepts responses from the web site, and updates the user's portfolio.
6. PAF shows the user the new portfolio standing.
Extensions:
2a. User wants a web site PAF does not support:
2a1. System gets new suggestion from user, with option to cancel use case.
3a. ...
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 39
Economics of communication: Casual (less expensive, less complete)
Buy something (Purchaser / user-goal level)
The Requestor initiates a request and sends it to her or his Approver, who completes the request for submission and sends it to the Buyer. The Buyer finds the best vendor, initiates PO with Vendor.
At any time prior to receiving goods, Requestor can change or cancel the request. Canceling it removes it from any active
processing.
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 40
Economics of communication: Brief (inexpensive, just a short note)
Actor Goal Brief Description
Production Staff
Preparedigitalcartographicsource
Convert external digital data to standard format, validate & correct in preparation for merging with operational database.
... ... ...
... ... ...
(Note: spreadsheets again!)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 41
3. Shortcut the use case structure (sometimes)
Use cases are not read by a compiler but by a human...--> so,
Don’t be rule-bound, but adapt the form to your needs.
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 42
Test department needs detailed requirements.Development can usually use agile ones.
Use cases
Dataformats
UI descr.
Program
Tests
Domainexpert
Usage expert R D
R D
(Detailed, expensive, long, tedious, brittle use cases)
(Shorter, cheaper, easier to read, more stable (agile) use cases)
(Test department)
R D
[Alistair’s generic process model]
(Development department)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 43
4. Write later and shortcut the process (usually)
Use cases *can be* written --just-in-time --or-- all up front
in (usable) increments --or-- each to completion
(more Agile) (more common)
Req'ts
Design
Validate syntax
Validate req'ts
Code
Validate logic
Use the “Validation V” view of increments
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 44
Project horizon -> all use case briefs or casualIteration horizon -> full use case, just-in-time
Full Project
S S
S
E E E E E E
Iteration Iteration Iteration
(all UCs, ultra-light content, estimation purposes)
(just-in-time, complete) (just-in-time, complete) (just-in-time, complete)
(10 use cases) (10 more use cases) (10 more use cases)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 45
Finally, Tools: Choose for the value it delivers, not for its popularity
• List of UCs for project planning & status:: Spreadsheets are very effective: Lotus Notes medium effective
• Main success scenario for agreement:: Flipcharts in meeting good for fast disagreement: Word processor (Lotus Notes) quite effective
• List of extension conditions for completeness:: Word processor quite effective: Flipcharts in project room? (untried)
• Extension handling steps for policies:: Word processor very effective: WikiWiki technology? (http://c2.com)
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 46
Summary of Agile Use Cases
• User’s goal level - Text - 3-9-step main scenario - No GUI - No data formats - Easy to read -Record of decisions made (not a tutorial)
• Write briefs and casuals to estimate & plan projectWrite full use cases just-in-time per iteration
• Just-in-time = extension-handling decisions made before the programmer gets around to asking for them.
• Spreadsheets good for briefs, planning activities.Focus on communicating, not filling templates
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 47
(1) In 10 minutes: Write a use case for a clerk entering a video rental into the computer.
( Write the basic dialog between the clerk and the system, Name all the things that could go wrong during the procedure. )
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 48
(2) In 10 minutes: Name all the use cases for a video rental store computer system.
( List every person who will use the computer system.For each person, list every reason they have to use the system. )
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 49
(3) In 5 minutes: Prioritize the list of UCs(order in which to develop & deliver them).
( Rank for when it is *really* needed, by dependency or business payback. )
Alistair Cockburn ©Humans and Technology, Inc., 2000-2003 Slide 50
Agile Use Cases
Alistair CockburnHumans and Technology
http://Alistair.Cockburn.us