0

I am realising a project only I do not understand whether the diagram is correct or not.

I've used a generalization for merging two CRUD operations. Is this correct?

Is the use case login correct if it includes the other use case, or is it better for the actor to have an association with the use case manger uc and include the use case login or are login and manger uc separate?

enter image description here

1
  • "Purachase Manger"
    – Astariul
    Commented Jul 16, 2024 at 7:07

2 Answers 2

6

This use case diagram isn't what I would consider correct.

First, Login isn't a use case. Use cases capture goals that an actor has when interacting with a system. Although logging in (and other forms of authentication) may be a prerequisite for achieving a goal, it isn't a goal itself. That is, no one uses a system to log in and then says that they've accomplished their goal. Because of this, there is no need to include Login as a use case on a diagram and it often adds clutter, making the diagram harder to understand.

Second, meta use cases don't belong. Again, each use case represents a goal. Because "pharmaceutical company management" isn't a specific goal that an actor has, it isn't a good use case. You seem to be using a use case to organize other use cases, which isn't their purpose.

However, as always, I would generally discourage use case diagrams. To quote Martin Fowler:

Use cases appear in the UML in the form of use case diagrams, but these diagrams are of little value - the key value of use cases lies in the text which is not standardized in UML. So when you do use cases put your energy into the text.

Instead, I'd point to various textual and tabular methods to capture use cases. Alistair Cockburn's Writing Effective Use Cases is one of the canonical texts going into detail on using use cases, including various formats and structures that may be useful.

7
  • Thank you, but in the book Apply Use case A practical Guide by Geri Schneider it says that that use case is correct, but it is better to consider it as a single case. Commented Jul 15, 2024 at 11:15
  • 1
    @lucagiuseppecaliò I have no idea who Geri Schneider is or why I would value their opinion over people like Martin Fowler or Alistair Cockburn. Not everyone's opinion is equal. I have no idea what the credentials of the author of your book is or why I would value their opinion more than others who are widely regarded as experts in object-oriented modelling and design, UML, and use cases.
    – Thomas Owens
    Commented Jul 15, 2024 at 11:29
  • However then I should directly link add and edit pharma to the actor? Commented Jul 15, 2024 at 11:38
  • 1
    @lucagiuseppecaliò Yes. The only two use cases in your diagram are "Add Pharma Company" and "Edit Pharma Company". If these represent goals that a Purchase Manager would want to achieve using the system and you feel the need to create a use case diagram, then they should be directly linked to the Purchase Manager actor.
    – Thomas Owens
    Commented Jul 15, 2024 at 12:02
  • and used this precondition :"The Manger shoud be logged " for all use case that required an autentication? Commented Jul 15, 2024 at 16:17
1

There is an appropriate way to use the include and extends functonality. (Many of the firms that provide UML diagramming tools have good tutorial sections. I found the one for IBM's Rational Software Modeler at ibm.com/docs/en/rsm/7.50 apropos to the original poster's needs.)

"Add Pharma Company" and "Edit Pharma Company" may have common features as pharmaceutical company management functions. Perhaps it may just be a look and feel. (Note, if pharmaceutical company management were a separate system, one might put a box around it.) In that case one can use the extends relation to indicate that. (Note that this is the same as extending a class in a UML class diagram, if A and B use common features, it may be appropriate to have them extend something (a C), whether they be classes or use cases.) Revised UML diagram based upon the above discussion.

It is appropriate if several use cases use a common functionality like logging in, then the < is appropriate. But one would have the pharmaceutical management functions <> I did not do it, but it would be very appropriate to have the super use case "Pharmaceutical Company Management Function" have the <> arrow to the login function.

Of course, as several of the people making comments pointed out, we all know that one must log in to a system prior to doing anything else. Thus, it might be superlative to indicate "<>" for login. But that is a style issue whose discussion is beyond the scope of THIS forum.

3
  • Interesting answer. The notation used is however confusing since the generalization relationship is different from the «extends» stereotype and its concept of extension points, yet you add a Extends. Moreover login is not a use case: it's a constraint for the other use-cases.
    – Christophe
    Commented Jul 16, 2024 at 12:21
  • As a general rule, I would recommend you not to have crossing lines. This is very bad for readability.
    – Dominique
    Commented Jul 16, 2024 at 12:38
  • The first answer to Stack Overflow Question # 76613601 on "UML: all use cases require login [duplicate]" covers Christophe's comment (last sentence). Commented Jul 16, 2024 at 12:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.