简体   繁体   English

什么是用例场景?

[英]What is a use case scenario?

So, I'm learning various aspects of design and architecture, such as UML and use cases.因此,我正在学习设计和架构的各个方面,例如 UML 和用例。 But I'm not getting what a use case scenario is and I can't find much about it.但是我没有得到什么是用例场景,我也找不到太多关于它的信息。 Can anyone explain them to me?谁能给我解释一下?

A use case describes some added value a system under consideration will have.用例描述了正在考虑的系统将具有的一些附加值。 To achieve this added value there are usually a multitude of steps to be performed.为了实现这一附加值,通常需要执行多个步骤。 A use case includes these steps in Activities.用例包括活动中的这些步骤。 There is at least one sunny side activity which details the steps to be performed.至少有一个阳光边活动,详细说明了要执行的步骤。 That's also called a scenario.这也称为场景。 You will additionally have quite some scenarios (/Activities) that describe failure and exception paths or alternate ways to achieve the added value.您还将有相当多的场景(/活动)描述失败和异常路径或实现附加值的替代方法。 The Activity itself contains all the Actions needed along with the controlled path they will have to take.活动本身包含所有需要的操作以及它们必须采取的受控路径。

tl;dr tl;博士

A scenario is another term for a UML Activity.场景是 UML 活动的另一个术语。

As always I recommend to read Bittner/Spence about Use Case Modeling.与往常一样,我建议阅读 Bittner/Spence 关于用例建模的内容。 It's a complex thing and especially IT people have difficulties in grasping what it's all about.这是一件复杂的事情,尤其是 IT 人员很难理解它的全部含义。

To complement qwerty_so 's vey clear and insightful answer: The scenario isn't necessarily described as an activity diagram.为了补充qwerty_so的清晰而有见地的答案:该场景不一定被描述为活动图。 Very often, the scenarios are first identified and described in plaintext, before being formalized in an activity diagram:很多时候,场景首先以明文形式被识别和描述,然后在活动图中被形式化:

  • A very popular format is Alistair Cockburn's template (see here with some examples).一种非常流行的格式是 Alistair Cockburn 的模板(请参阅此处的一些示例)。 He suggests to start with a main success scenario, then provide alternative scenarios (for slight variations, extensions, as well as the unhappy case such as errors, exceptions, failures).他建议从一个主要的成功场景开始,然后提供替代场景(对于细微的变化、扩展,以及不愉快的情况,例如错误、异常、失败)。 By the way, his book "Writing effective use-cases" is a must-read in the field, even if it's more about use-cases than about UML.顺便说一句,他的书“编写有效的用例”是该领域的必读书籍,即使它更多地是关于用例而不是关于 UML。

  • There are many other templates used and sometimes scenarios are called "flow" or "path".使用了许多其他模板,有时场景称为“流”或“路径”。 They can be presented in a tabular form or in a chronologicaly numbered sequence .它们可以以表格形式按时间顺序编号的顺序呈现。 Sometimes the tabular description has a column for the actor actions and a column for the system action.有时表格描述有一个用于参与者操作的列和一个用于系统操作的列。

An entire use case can be represented by one activity definition, comprising elements such as decision nodes and activity usages.一个完整的用例可以由一个活动定义来表示,包括决策节点和活动使用等元素。 A scenario is one particular path through such an activity definition.场景是通过此类活动定义的一条特定路径。 Imagine printing an activity definition and then using a highlighter to trace through decision diamonds.想象一下打印一个活动定义,然后使用荧光笔跟踪决策菱形。 That's a scenario.那是一个场景。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM