32

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

Community
  • 1
  • 1
Robin
  • 6,726
  • 4
  • 47
  • 75

4 Answers4

22

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.

Uffe
  • 9,791
  • 1
  • 27
  • 37
  • Thank you for your answer! I've added two new choices which are based on your answer. What do you think about it? Is that in your thought? – Robin Oct 15 '11 at 19:31
  • 3
    To add injury to insult ;-) #3 is drawn the wrong way around. – qwerty_so Apr 22 '15 at 12:16
13

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.

2

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).

Jordi Cabot
  • 7,432
  • 2
  • 27
  • 37
0

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.