在 UML 中包含或扩展? [英] include or extend in UML?

查看:20
本文介绍了在 UML 中包含或扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,扩展关系是用例是可选的,但包含是需要用例的操作(但不是所有时间).我想为注册系统建模一个用例,但对使用哪种关系有疑问,我有两个可能的选择:

For what I know an extend relationship is when a use case is optional, but the include is when the operation of the use case it is needed (but not all the times). I want to model a use case for a registration system and came with a doubt about which relationship to use, the two possible options that I have are:

我更喜欢 (b) 表示此操作的方式,因为修改数据和删除数据的部分不应该是可选的,它们用于维护学生的记录(对不起,我的图表中的错字).尽管一位同事表示 (a) 选项更准确地处理这种情况.两者都可以吗?如果是在哪种情况下会发生这种情况?谢谢

I am more keen on the (b) way of representing this action because the parts of modify data and delete data should not be optional and they serve for the maintenance of the students' records (sorry for the typo in my graph). Even though one colleague states that the (a) option is more accurate to deal with this situation. Can both be correct? and if it is the case in which situation this could happen? Thanks

推荐答案

当您设计用例时,一个容易陷入的陷阱是功能分解",您将用例分解成太多子用例.这里的一个经典是 CRUD 操作.虽然维护记录"是一个明智的用例,但您很少希望将其分解为创建记录、删除记录等.因此,在某种程度上,您关于包含..."与扩展..."问题的答案是都不是".

When you are designing Use Cases, an easy trap to fall into is 'functional decomposition' where you break down a Use Case into too many sub cases. A classic here is in CRUD operations. While "Maintain Records" is a sensible use case, you rarely want to decompose this into Create Record, Delete Record etc. So to some extent, the answer to your question about 'include...' vs 'extend...' would be 'neither'.

有时,假设一个参与者可以搜索,而只有特定参与者可以创建记录,或者如果删除记录有一个特别复杂的身份验证步骤,您可能需要制作这些单独的用例.在这种情况下,您可能不需要维护记录"用例,但需要分别描述这两种情况.

Sometimes, say if one actor can search while only a specific actor can create a record, or if there's a particularly complex authentication step in deleting a record, you may want to make these separate Use Cases. In this case you may not need the 'Maintain Record' Use Case but would describe the two cases separately.

如果您必须同时拥有两者,那么我建议修改数据"扩展维护记录",因为您有时可能会执行它,但并非总是如此.

If you must have both then I would suggest that 'Modify Data' extends 'Maintain Records' because you may perform it sometimes but would not always.

查看此答案:用例图中的 CRUD?

您可能会发现有用的讨论在这里 http://www.se.cs.put.poznan.pl/knowledge-base/software-engineering-blog/crud-pattern-in-use-cases

And a discussion you might find useful is here http://www.se.cs.put.poznan.pl/knowledge-base/software-engineering-blog/crud-pattern-in-use-cases

这篇关于在 UML 中包含或扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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