Expressing Requirements with User Stories:用 User Stories来表达需求

User Stories

Once a requirement is elicited, it needs to be expressed in some form. One technique for expressing a requirement is called a user story. A user story is simply a requirement, often from the perspective of an end-user, which is stated in natural language. You may have seen Sam using one of these in the previous video. A user story looks like this:
As a ______, I want to ______ so that ______.
Put the userrole into the first blank. This may be quite simple for software in which there is generally only one type of user, or a bit more complex in cases where the software may do different things for different people. Either way, this clarifies who wants to use this feature.
In the second blank, put the goal that the user role wants to achieve. This will lead to some feature that you want to implement.
After so that, put the reason why the user role wants this goal. Sometimes this clause is omitted if the benefits are clear and generally known.
After you fill in a user story, you can apply object-oriented thinking to it to discover objects and possibly further requirements!



Example

Imagine that you introduce the user story technique to your customer, and they give you the following sentence:
As an online shopper, I want to add an itemto my shopping cart, so that I can purchase it.
Usually, the nouns correspond to objects in your software. So in this example, you have identified three objects: first, the user role is associated with an object in the software (the online shopper). An item could be any product at the store, while a shopping cart is an object for tracking items for purchase.
Let’s have another look at the sentence:
As an online shopper, I want to add an item to my shopping cart, so that I can purchase it.
Verbs can help you identify the requirements that your objects might have. In this example, add and purchase might be responsibilities of the shopping cart. Verbs may also help you identify connections between objects.
The last point is a bit more subtle: a user story can also help you discover connections between objects. In this example, it is probably fairly obvious. One online shopper is typically associated with one shopping cart. The shopping cart should be capable of holding multiple items.



Conclusion

User stories are just one of many techniques that can be used to express requirements for a software system. They are simple to use and can allow you to apply object-oriented thinking and discover objects and further requirements. Start using them today, even if the ideas are your own! By identifying objects before starting implementation, your software will become better structured and more clear.



参考引用

Coursera:Object-Oriented Design 课堂笔记

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值