简体   繁体   English

我如何设计 UML 用例图

[英]How do i design a UML use case diagram

I am trying to design a use case diagram for the following scenario.我正在尝试为以下场景设计用例图。

I have a society that is distributing goods to clients based on their orders.我有一个社会,它根据客户的订单向客户分发商品。 These clients can be administrations, companies, or private individuals.这些客户可以是行政部门、公司或个人。 Depending on what the client is I want to know more or less of their info (name, number etc)根据客户是什么,我想或多或少地了解他们的信息(姓名、号码等)

The use cases are different depending on whether the client is:用例因客户端是否为:

  1. English英语
  2. English and have used this service for more than 3 years英语并使用此服务超过 3 年
  3. Foreign外国的

For example:例如:

  • The 1) English clients' orders are accepted only if they pay a small fee in advance. 1) 英语客户的订单只有在他们提前支付少量费用的情况下才会被接受。

  • The 2) English clients that have used the service for 3 years don't have to pay this fee but need to get approbation from a different actor (an Agent in this case) 2) 使用该服务 3 年的英语客户无需支付此费用,但需要获得不同演员(在这种情况下为代理人)的认可

  • The 3) Foreign clients' orders are always accepted no matter what. 3) 无论如何,外国客户的订单总是被接受。

This right here is where I run into trouble and need help with.这就是我遇到麻烦并需要帮助的地方。

The orders from nglish clients that have a criminal record are always denied UNLESS they are an administration.来自有犯罪记录的英国客户的订单总是被拒绝,除非他们是行政部门。

What are the most optimal actor choices here?这里最好的演员选择是什么? I thought of going with English client , and Foreign clients but I don't know how to include the "Unless the client is an administration" in the use case.我想过使用English clientForeign clients但我不知道如何在用例中包含“除非客户是管理人员”。

The use case diagram is not the right place to put this information.用例不是放置这些信息的正确位置。 As correctly pointed out by @Christophe, a use-case represents a goal for a user who is going to interact with the system to achieve the goal .正如@Christophe 正确指出的那样,用例代表将与系统交互以实现目标的用户的目标

This means that there is only one single use case in your scenario: "Order Goods" .这意味着您的场景中只有一个用例: "Order Goods" However, it has a set of preconditions .但是,它有一组先决条件 You could list them as structured plain text.您可以将它们列为结构化纯文本。 Since there is quite some complexity behind each of them, I recommend to put them into a separate decision chart.由于它们每个背后都有相当多的复杂性,我建议将它们放入单独的决策图中。 Then you have a nice clean separation of the diagram scopes, and they remain easily readable.然后,您可以很好地将图表范围分开,并且它们仍然易于阅读。

Sidenote: There could be a second one "distribute ordered goods" executed by a 2nd actor who is an employee who does fulfillment / routing / dispatching.旁注:可能会有第二个“分发订购的货物”由第二个演员执行,该演员是执行/路由/调度的员工。

Actors in UML use-cases are classifiers. UML 用例中的参与者是分类器。 To decide about which actors to create requires to understand the actors their goals and behaviours and how they differ in the interaction with the system.要决定创建哪些参与者,需要了解参与者的目标和行为,以及他们与系统交互的不同之处。

First of all, you need to clarify the super-ambiguous requirements:首先需要明确一下超模棱两可的需求:

  • " English client ": is this a client with English nationality? 英国客户”:这是英国国籍的客户吗? Is it a client that lives permanently in the UK?它是永久居住在英国的客户吗? Is this a client with an address in the UK?这是在英国有地址的客户吗? Is it a client with a +44 phone number?是+44电话号码的客户吗?
  • " Foreign client ": same kind of questions + can you define for sure the difference between Ensglish and Foreign? 外国客户”:同样的问题+你能确定英文和外国的区别吗? For example: what with bi-nationals?例如:双国籍怎么办? what with people having two addresses one being abroad?有两个地址的人一个在国外怎么办?
  • " Using this service more than three years ": what with a foreign customer who uses the service for 3 years and then settles in the UK? 使用此服务三年以上”:外国客户使用该服务三年后定居英国怎么办?
  • Since you deliver goods, you might also need to consider a delivery address.由于您送货,您可能还需要考虑送货地址。 What with an English client ordering on a foreign address or vis-versa ?如果英国客户在外国地址上订购或反之亦然呢?
  • " criminal record ": the criminal record might change over time: is it provided at each purchase? 犯罪记录”:犯罪记录可能会随着时间的推移而改变:每次购买时都会提供吗? or is it part of the customer registration process ?还是客户注册过程的一部分? In the latter case, is there a need to periodically renew this information ?在后一种情况下,是否需要定期更新此信息?

Use-cases should in principle be goal oriented.用例原则上应该是面向目标的。 So a use-case represents a goal for a user who is going to interact with the system to achieve the goal.因此,用例代表将与系统交互以实现目标的用户的目标。 Use-cases are not meant to describe the detailed sequence of your process (if client is this, do that, etc...) and neither are actors meant for that purpose.用例并不意味着描述你的流程的详细顺序(如果客户是这个,那么做,等等……),参与者也不是为了这个目的。

You should therefore consider reformulating the use-cases to represent how the actors would perceive them.因此,您应该考虑重新制定用例以表示参与者如何看待它们。 If needed you may consider the status of the actor that could explain that an actor behaves very differently.如果需要,您可以考虑演员的状态,这可以解释演员的行为非常不同。 Typically in your case, I could imagine :通常在你的情况下,我可以想象:

  • New client: a new client may want to provide details (address, identification) or evidence that they are entitled to buy (criminal record - I suppose your activity is regulated if you request such details)新客户:新客户可能想要提供详细信息(地址、身份证明)或他们有权购买的证据(犯罪记录 - 如果您要求提供此类详细信息,我想您的活动将受到监管)
  • Public administration: behavior of administration in purchase is anyway different because of public procurement and legal constraints.公共行政:由于公共采购和法律限制,采购中的行政行为无论如何是不同的。
  • Privately owned company: behavior is different since it can involve several persons,私营公司:行为不同,因为它可能涉及几个人,
  • Private individual私人个体

The need to pay an advance fee seem to depend on the address, nationality, history.是否需要支付预付费用似乎取决于地址、国籍、历史。 It's more related to the process (it's a part of it) than an independent goal for an actor.它与过程(它是过程的一部分)的相关性比演员的独立目标更相关。 So I would neither show this as a use-case nor make different actors for this purpose.因此,我既不会将此作为用例展示,也不会为此目的制作不同的演员。

The reason to deny an order is not something that is not relevant for the customer (no customer has a goal go get a purchase denied!).拒绝订单的原因与客户无关(没有客户有目标,拒绝购买!)。 It's relevant to you and your system and is a consequence of the registration process.它与您和您的系统相关,是注册过程的结果。 So no need to have a dedicated actor for that.所以不需要专门的演员。

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

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