CRUD in a use-case diagram?
Asked Answered
H

4

42

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

Hemimorphic answered 14/10, 2011 at 19:7 Comment(0)
I
29

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.

Ilyssa answered 15/10, 2011 at 7:59 Comment(3)
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?Hemimorphic
To add injury to insult ;-) #3 is drawn the wrong way around.Avenge
I would go with #4, because it is neat and descriptive. #1 is a bit "verbose" (those use cases can be turn into alternative scenarios of the use case "Manage User"), #2 e #3 are plainly wrong.Rabato
C
17

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.

Cythera answered 4/6, 2016 at 10:39 Comment(0)
P
3

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

Punkah answered 15/10, 2011 at 7:59 Comment(0)
M
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.

Mowbray answered 21/9, 2020 at 19:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.