使用案例图:何时分解用例,何时不分解?

huangapple go评论53阅读模式
英文:

Use-case diagram: When to decompose use-case and when not to?

问题

  • 例如,假设我想为一个类似的人工自动售货机绘制用例图,如下所示:

  • 自动售货机有3个选项:碳酸饮料纯净水

  • 用户只能选择上述其中一种进行订购:

    • 如果用户选择碳酸饮料,则用户需要选择品牌,例如可口可乐或百事可乐。
    • 否则,如果用户选择,则需要选择糖的数量。
    • 或者如果用户选择纯净水,那就是全部了。
  • 在选择饮料之后,用户还必须选择饮料的数量(有点牵强)。然后,机器会发送确认消息供用户确认。

我尝试过这个,但不太确定,不知道要保留什么,要添加什么或删除什么。

问题如下:

  • 这里的“选择饮料数量”和“确认”应该作为独立的用例保留,还是应该与总体用例“购买一种饮料”合并?

  • 如果至少要保留其中一个,它们应该被绘制为“购买一种饮料”的包含用例,还是应该绘制为独立的用例?

  • 我考虑将3个用例“购买碳酸饮料”、“购买茶”、“购买纯净水”看作是“购买一种饮料”的离散化。对于“购买碳酸饮料”和“购买茶”,我是否应该保留包含用例:“选择品牌”和“选择糖的数量”,还是应该将它们删除?

  • 更一般的问题:在什么情况下,执行某个大用例的步骤应该保留为用例,什么情况下不应该? 这里有很多类似的问题,但答案不一致。

英文:

For an example, say, I want to draw a use-case diagram for an artificial vending machine like so:

  • The vending machine have 3 options: carbonated drinks, tea, and pure water.

  • The user can choose only 1 of the above for an order:

    • If the user chooses carbonated drinks, the user needs to choose which brand: say Coke or Pepsi.
    • Else if the user chooses tea, then he/she have to choose the amount of sugar.
    • Else if the user chooses pure water, then that's it.
  • After choosing the drinks, the user then has to choose the number of drinks (a little bit contrived). The machine then sends out a confirmation message for the user to confirm.

I tried this but not really sure of it, don't know what to keep, what to add or what to remove..

The questions are:

  • Should the 2 Choose the number of drinks and Confirm here be kept independently as use-cases, or should they be merge with the grand use-case: Buy a kind of drink?

  • If at least 1 of them is to be kept, should I draw them as including use-case of Buy a kind of drink or should they be drawn as independent use-cases?

  • The 3 use-cases Buy carbonated, Buy tea, Buy pure water I considered as the discretization of Buy a kind of drink. For Buy carbonated and Buy tea, should I keep the including use-cases: Choose brand and Choose sugar amount or should I remove them also?

  • More general question: When should a step of doing some big use-case should be kept as a use-case, and when shouldn't? There are a lot of questions on here that are the same, but the answers are non-consistent.

答案1

得分: 1

使用案例关注的是“是什么”,而不是“如何”。后者涉及到活动,并分为行动。用例只展示了一个正在考虑的系统为其参与者带来的附加值。

因此,唯一的附加值是“销售饮料”,仅此而已。

我建议阅读Bittner/Spence关于用例的内容。他们称之为“综合”,这是正确的词汇。不是分析,更不是分解。

奇怪的是,技术人员总是想要分解事物。嗯,我知道学习起来很困难,因为我也曾困惑不解。这可能是因为它涉及到简单性。

英文:

Use cases are about the what and not about the how. The latter goes into Activity and is split to Actions. Use case only show the added value a system under consideration brings to its actors.

So the only added value is Sell drinkand that's it.

I recommend reading Bittner/Spence about use cases. They call it synthesis and that's the right word. Not analysis and even less decomposition.

Strange, that techies always want to decompose things. Well, I know it's hard to learn since I had been scratching my head too. It's probably so complicated because its about simplicity.

huangapple
  • 本文由 发表于 2023年8月9日 11:21:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76864351-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定