OOD实例阅读笔记(二)
Use case 图包括的内容
Use case图是用于需求分析的工具。他和实现技术没有任何关联。他的目的写出特定情况下的需求。
首先就是要有一定的场景。场景包括特定的环境(case 发生的条件),参与的人(action)和系统所做的响应。
一般情况下回采用黑箱的use
case(blak – box
use case)。黑箱的use case不关心具体的实现。只是确定系统的责任。
下面就提供一个use
case的描述。
USE
CASE 5
|
Buy Goods
|
Goal
in Context
|
Buyer issues request directly to our
company, expects goods shipped and to be billed.
|
Scope
& Level
|
Company, Summary
|
Preconditions
|
We know Buyer, their address, etc.
|
Success
End Condition
|
Buyer has goods, we have money for the
goods.
|
Failed
End Condition
|
We have not sent the goods, Buyer has not
spent the money.
|
Primary,
Secondary
Actors
|
Buyer, any agent (or computer) acting for
the customer.
Credit card company, bank, shipping
service
|
Trigger
|
purchase request comes in.
|
DESCRIPTION
|
Step
|
Action
|
|
1
|
Buyer calls in with a purchase request
|
|
2
|
Company captures buyer’s name, address,
requested goods, etc.
|
|
3
|
Company gives buyer information on goods,
prices, delivery dates, etc.
|
|
4
|
Buyer signs for order.
|
|
5
|
Company creates order, ships order to
buyer.
|
|
6
|
Company ships invoice to buyer.
|
|
7
|
Buyers pays invoice.
|
EXTENSIONS
|
Step
|
Branching
Action
|
|
3a
|
Company is out of one of the ordered
items:
3a1.
Renegotiate order.
|
|
4a
|
Buyer pays directly with credit card:
4a1.
Take payment by credit card (use case 44)
|
|
7a
|
Buyer returns goods:
7a.
Handle returned goods (use case 105)
|
SUB-VARIATIONS
|
|
Branching
Action
|
|
1
|
Buyer may use
phone
in,
fax
in,
use
web order form,
electronic
interchange
|
|
7
|
Buyer may pay by
cash
or money order
check
credit
card
|
RELATED
INFORMATION
|
5. Buy Goods
|
Priority:
|
top
|
Performance
|
5 minutes for order, 45 days until paid
|
Frequency
|
200/day
|
Channel
to actors
|
not yet determined
|
OPEN
ISSUES
|
What if we have part of the order?
What is credit card is stolen?
|
Due
Date
|
release 1.0
|
...any
other
management
information...
|
|
Superordinates
|
Manage customer relationship (use case 2)
|
Subordinates
|
Create order (use case 15)
Take payment by credit card (use case 44)
|
这个例子是http://alistair.cockburn.us/usecases/usecases.html
中的template的一个很整是的例子。
下面我在举一个修改密码的case.
Change Password
该case在用户选这修改密码是触发。Check输入的两个密码是否相同。Check当前用户然后更新数据库。
Purpose
允许用户修改自己的密码。
Overview
这个case是为了给用户提供修改密码的可能。用户可以通过点击“Change My Pasword”菜单项来触发。系统会弹出一个对话框供用户输入他的新密码。用户可以按“OK”或“Cancel”来选择保存或放弃修改。系统这时会检验用户输入的信息是否正确。如果用户输入正确,保存用户信息,返回主窗体。否则给用户重来的机会。
Typical Course of Events
|
Line
|
Actor Action
|
System Response
|
1
|
用户点击”Chang My Password”菜单项。
|
|
2
|
|
系统显示一个可以让用户输入新密码和Comfirm的对话框。
|
3
|
用户输入信息并点击”OK”按钮.
|
|
4
|
|
系统Check输入的信息。
|
5
|
|
把用户输入的信息更新到数据库。
|
6
|
|
关闭对话框。显示修改成功或失败的提示信息。结束当前case.
|
Alternative courses
|
3
|
用户不点”OK”而点击”Cancel”。关闭对话框,结束该case.
|
4
|
系统监测到下列三种情况的一个:(1)旧的密码不正确。(2)两次输入的新密码不相同。(3)新密码格式不正确。系统显示一个错误信息。清除当前对话框中的内容。允许用户重试。返回到第3步。
|
5
|
系统保存出错。显示错误信息。结束当前case.
|
|