用例中的前提条件 [英] Precondition in an Use Case

查看:32
本文介绍了用例中的前提条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为学校项目创建用例,但我对前提条件字段感到困惑.我可以理解先决条件,例如必须登录"或需要一个帐户".

I'm creating a Use Case for a project for school and I'm confused about the precondition field. I can understand preconditions like, "must be logged in" or "needs an account."

但是如果软件是本地设置呢?对我来说,先决条件是需要安装软件"这听起来很合乎逻辑.但另一方面,这个先决条件看起来很奇怪,因为否则,你一开始就不会有这个用例.

But what if the software is a local setup? To me, it sounds logical that a precondition is that "the software needs to be installed." But on the other hand, this precondition looks weird because otherwise, you would not have this Use Case in the first place.

简而言之,我的问题是:系统要求或软件安装可以作为前提条件的一部分吗?

So my question, in short, is: Can system requirements or software installation be a part of a precondition?

推荐答案

解决 UML 问题核心的真正好问题 - 它是弱语义.因此,您的问题的答案是 - 可能是对的,也可能是错的.UML 设置符号规则,并仅定义基本元素语义(例如必须按顺序满足先决条件......").

Really good question that tackles the heart of the UML problems - it's weak semantics. The answer to your question is therefore - could be right, could be wrong. UML sets the notational rules, and defines only basic element semantics (e.g. "A precondition must be fulfilled in order...").

我们甚至可以在诸如应正确配置操作系统"或更糟糕的前提条件下走得更远——计算机有电"……这些讨论很容易变成哲学.:)

We could even go further with preconditions like "operating system should be correctly configured" or even worse - "computer has electricity"... These discussions can easily turn philosophical. :)

根据我的经验,有一种方法可以使用例高效 - 构建另一个 UML 模型,一个互补的模型,该模型将用于制定前置条件、后置条件甚至用例场景(您为前置条件提出的相同问题可以也适用于场景 - 哪个是场景的正确抽象?或者,打开计算机?"是场景中的有效步骤吗?).

In my experience there is a way to make use cases efficient - build another UML model, a complementary one, which would be used to formulate preconditions, postconditions and even use case scenarios (the same question you made for preconditions can be made for scenarios as well - which is a correct abstraction for a scenario? Or, is "turn on computer?" a valid step in a scenario?).

为了实现这一点,我通常使用概念类图 - 我对我的领域进行建模,然后根据这些元素(类及其属性)表达前/后条件和场景,并且仅使用这些元素.这很有意义,尤其是知道前置/后置条件查询系统的状态,由对象/值巧妙地反映.

In order to achive this I normally use conceptual class diagrams - I model my domain and then express pre/post conditions and scenarios in terms of these elements (classes and their attributes) AND ONLY USING THESE ELEMENTS. This make a lot of sense, especially knowing that pre/postconditions query system's state, neatly reflected by objects/values.

回到你的例子,如果你想知道需要安装软件"的前提条件,你只需问自己我真的需要一个属性为‘isInstalled’的‘Software’类吗?"

Returning to your example, if you wonder about the precondition "the software needs to be installed", you simply ask yourself "Do I really need a class 'Software' with an attribut 'isInstalled'?"

然后您很可能意识到您可能不需要这个先决条件,因为它太低级"并且超出了我的域的范围.现在您只需要定义您的域.:) 这是一个类似情况的简单示例,演示了这个想法(请记住,用例和类模型是在单独的图表上绘制的):

Then you most likely realize that you probably do not need this precondition because it is simply too "low level" and out of my domain's scope. Now you just need to define your domain. :) Here is a simple example of a similar situation, demonstrating the idea (keep in mind that use case and class models are drawn on separate diagrams):

这种方法不仅使指定用例变得更容易,而且还使补充类模型允许域规范、业务规则识别和系统设计的第一个抽象.

This method not only make it easier specifying use cases, but also make complementary class model which permit domain specification, business rules identification and a first abstraction of the system design.

祝你好运,玩得开心!

这篇关于用例中的前提条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆