2006年09月28日

以前用过UML,对Use Cases相对比较熟一点,最近在学习Agile的过程中,接触了一个新的概念,User Stories。 但是怎么就感觉说的和Use Cases是一回事,正好在《User Stories Applied: For Agile Software Development》一书的FAQ中发现了相关内容。

书中提及,“One of the most obvious differences between stories and use cases is their scope.”“ stories are kept smaller in scope because we place constraints on their size (such as no more than ten days of development work) so that they may be used in scheduling work. A use case almost always covers a much larger scope than a story.”“ Each story is not necessarily equivalent to a main success scenario”。按照这样的理解,Use Cases是针对一个比较完整的用例,包含正常情况和各种非正常的情况。相对的,User Stories更像是把User Cases break down,并排列整合起来。

Another important difference between use cases and stories is their longevity. Use cases are often permanent artifacts that continue to exist as long as the product is under active development or maintenance. Stories, on the other hand, are not intended to outlive the iteration in which they are added to the software. While it is possible to archive story cards, many teams simply rip them up.”对此,非常不理解,为何Stories就在迭代周期外不应存在呢?继续读下去。。。

Another difference is that use cases and stories are written for different purposes (Davies 2001). Use cases are written in a format acceptable to both customers and developers so that each may read and agree to them. Their purpose is to document an agreement between the customer and the development team. Stories, on the other hand, are written to facilitate release and iteration planning, and to serve as placeholders for conversations about the users’ detailed needs.”感觉这该是一个非常重要的差异,因为其他一些区别是基于这个差异的。

Finally, use cases are generally written as the result of an analysis activity, while user stories are written as notes that can be used to initiate analysis conversations.

读完了这些,基本上对作者想要阐述的区别有了一个大致的了解。由于两者存在的目的不同,Use Cases是为了让Business方和Software方能有一种双方能够理解的沟通方式并达成一致,使以后的软件开发有个依据,以遵从Business方的需求。而相对应的,User Story是为了在一个迭代周期内制定计划的。所以,他们的内容也许很相似,但是本质却很不一样。Use Case更有些为Software一方服务,可说是一个类似architecture的工具,而User Story更站在用户角度,主要为了Schedule,可以说是一个类似Project Management的工具。鉴于以上的目的不一致,表现形式的不一致也就可以理解了。所以,虽然Use Case是一个比较概括的东西,但是却必须是非常Serious的,相对而言,User Story就比较随意些。

顺便翻了下《UML Distilled: A Brief Guide to the Standard Object Modeling Language, Third Edition》,正好也简短的说到了两者的差距,觉得说得比较到位。

Features are a good way of chunking up a system for planning an iterative project, whereby each iteration delivers a number of features. Use cases provide a narrative of how the actors use the system. Hence, although both techniques describe requirements, their purposes are different.

并且,提供了一种比较好的建议,很赞同。

Although you can go directly to describing features, many people find it helpful to develop use cases first and then generate a list of features. A feature may be a whole use case, a scenario in a use case, a step in a use case, or some variant behavior, such as adding yet another depreciation method for your asset valuations, that doesn’t show up in a use case narrative. Usually, features end up being more fine grained than use cases.