一个用例是描述用户与系统之间的一个交互场景,Bob去ATM取钱,John打电话给10010寻问电话卡 上的余额等这些都是一个用例,这里需要注意的是,用户不一定就是指人,可以是任何需要系统服务的单位。Wikipedia对Usecase的定义如下:
A use case in software engineering and systems engineering is a description of a system’s behavior as it responds to a request that originates from outside of that system.
Generalization among use cases is just like generalization among classes. Here it means that the child use case inherits the behavior and meaning of the parent use case; the child may add to or override the behavior of its parent; and the child may be substituted any place the parent appears (both the parent and the child may have concrete instances).
之后Ketty发现,“歌唱者”在点歌时如果余额不足,则需要进行充值,而充值是另一个用例。这个 用例只是当余额不足时才进行,因此Ketty把它作为了一点歌的扩展用例。这个就是:Extend的关系。也就是说,Extend是描述用例可能会引出另一个用例的情况。这个时候 基用例的责任(Reponsibility)就被扩展了。《UML User Guide》给出的定义是:
An extend relationship between use cases means that the base use case implicitly incorporates the behavior of another use case at a location specified indirectly by the extending use case. The base use case may stand alone, but under certain conditions, its behavior may be extended by the behavior of another use case.
An include relationship between use cases means that the base use case explicitly incorporates the behavior of another use case at a location specified in the base. The included use case never stands alone, but is only instantiated as part of some larger base that includes it. You can think of include as the base use case pulling behavior from the supplier use case.
评论列表: