简体   繁体   中英

CRUD in a use-case diagram?

My question is quite simple. What is the best way to bring CRUD into a use-case diagram? It should be DRY . I know, UML is sometimes discretionary, but what do you think about it?

Some ideas:

1 use-case diagram

用例 1

  • Not really DRY, if there are a few CRUD objects.

2 use-case diagram

用例2

  • Not really DRY, if there are a few CRUD objects.

3 use-case diagram

用例3

  • I prefer this.

Update

4 use-case diagram (@Uffe)

在此处输入图片说明

  • Note maybe needless, when it is described in the documentation?

5 use-case diagram (@home @Uffe)

在此处输入图片说明

Out of these, I would say #3 is actually the worst, because "CRUD" on its own is not a use case at all; you always CRUD something . Don't confuse use case <<extend>> with class inheritance.

Option #2 is not very good either, because running through a "manage user" use case does not mean you perform all four CRUD actions.

If you really want to be this explicit in your use cases, #1 has my money. But if it were me, I would just put a single "Manage Users" use case in there.

Since user (or something else) management is a well-understood concept, a "Manage Users" use case is actually pretty self-explanatory and doesn't need detailing into several use cases unless there are specific reasons to do so (for instance, if the system you're analyzing the requirements for is an authentication mechanism). If that is the case, use #1.

According to the book "Applying UML and Patterns-Craig Larman", we can use "Manage User" for use case name to show CRUD operation in use case. No 4 is good choice and in this case we shoud describe CRUD operations in scenario. Create user in main flow of events and the others in alternative flow of events.

只要公司对 CRUD 的确切含义有隐含或明确的理解(即每个人都应该同意它只是意味着输入所有数据的基本形式,如果一个类需要更复杂的输入过程,那么它应该被建模为一个单独的用例)。

I would put another option in discussion and meybe I would use this one, lets consider number 6 alternative. Put the 4 operations inside a system boundary called "CRUD User", it also helps because not all users always have access to all crud operations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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