CRUD in a use-case diagram?

2019-01-16 09:02发布

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

usecase1

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

2 use-case diagram

usecase2

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

3 use-case diagram

usecase3

  • I prefer this.

Update

4 use-case diagram (@Uffe)

enter image description here

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

5 use-case diagram (@home @Uffe)

enter image description here

3条回答
迷人小祖宗
2楼-- · 2019-01-16 09:43

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.

查看更多
Root(大扎)
3楼-- · 2019-01-16 10:03

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.

查看更多
等我变得足够好
4楼-- · 2019-01-16 10:08

I´d vote for three as long as there is an implicit or explicit understanding in the company of what exactly you mean by CRUD (i.e. everybody should agree that it simply means basic forms to enter all the data, if a class needs a more complex input process then it should be modeled as a separate use case).

查看更多
登录 后发表回答