CRUD in a use-case diagram?

Robin picture Robin · Oct 14, 2011 · Viewed 21.8k times · Source

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

Answer

Uffe picture Uffe · Oct 15, 2011

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.