2

我正在做需求分析,所以我正在写一些用例图。virtual test case我将尝试通过以下示例阐明我的意思:

我有一组操作,例如 { create, read, update, delete}。我想将它们分组为一种virtual use case,以便以后扩展它并为每个操作创建一个新的用例。就像是:

  o
 -|- ----- ( basic operation ) <---- <<extends>> --- ( read )
 / \

理论告诉我这是不正确的,因为用例中的扩展将引入基本用例描述的基本动作序列的变化。在我的例子中,basic operation用例没有真正的意义,所以它没有相关的动作序列。

这对于根据菜单项对操作进行分组很有用:

File Operations = {Save, Save As, Print, Exit}

你会如何表达这样的事情?

4

2 回答 2

1

从您的问题来看,我认为您尝试做的主要事情之一是表达许多用例之间的逻辑关系。更具体地说,您试图表明许多用例(例如“保存文件”、“打印文件”等)在功能上是相关的(“文件操作”)。

您可以使用UML 包来表达这种关系。例如,您可以创建一个包含相关用例的“文件操作”包:“保存文件”、“打印文件”等。

于 2009-09-29T16:44:11.913 回答
0

Well the UML spec allows for a use case to be abstract. You could use the keyword of <> or italics. I would say virtual and abstract are one and the same at the use case level, this is just like with classes. Use Case is a type of classifier in UML, I think.

You could also use templating and create a template use case and require that any instances then complete the parameters of create, read, update, delete which would need to be filled in. You could still mark the template use case abstract to help clear this up. This is the more serious, captured in the model, not just the diagram, approach. Literal Strings will give you more flexability, operations would require an claas to participate and provide the operation, not as desirable.

You might also consider extension points on use cases, but I know less about these.

于 2009-09-28T22:46:17.737 回答