Use case diagram: actor with more permissions - uml

Regarding Use-Case Diagram:
Consider 2 kinds of actors: Customer & User. Customer is a User (generalization)
I want to model the use case of a Search option for items ('search items') which is allowed for all users without the need for a login : but only a customer (because he is registered) could take part in the use case add items. note that this means that the customer will also need to be logged in for this to happen.
I can't seem to make it work without messing up the whole diagram.
Thanks!

Simply add a constraint to the use case. You can make that visible in a diagram by using a constraint element which looks like a note but has the text enclosed in curly brackets.

As is noted in the specs:
NOTE. An Actor does not necessarily represent a specific physical entity but instead a particular role of some entity that is
relevant to the specification of its associated UseCases. Thus, a single physical instance may play the role of several different
Actors and, conversely, a given Actor may be played by multiple different instances.
Thus there is no reason to try to mash multiple use cases into single Actor; User and Customer represents two different roles and thus it is often better to represent it by two actors; the fact that Customer is derivation of User can represented by ­a generalization.
And finally you can add a note to the use-case association to specify that the Customer has to be logged in - but at least for me this seems unnecessary, because the User already had to log in in order to take on the "Customer" role.

Related

Better UML class diagram structure to represent marriage of individuals

Currently I am working on a part of a bigger project, but I am not quite sure how to approach this part of the system.
Each individual can be married multiple times, each marriage needs to have an officiant, partner1, partner2 and witnesses. Individuals can represent these roles in multiple marriages.
I am wondering if there is a way to represent all of the necessary individuals with less associations, since the diagram quickly turns into a mess when looking at the whole system.
Updated class diagram
Replace partner1 and partner2 by partner with multiplicity 2, and of course same for partnerWitness
individualId and marriageId are wrong because written underlined that mean they are static. Probably they are primary-key, but they are instance-member, not class-member. You can also name them id, useless to have a prefix
What is statusPartner ? is that can be supported by a class-association ?
The separated relation Individual -> Marriage is wrong because like that it can be for a marriage which not the same as the marriage the individual participate whatever its role, and this is not what you want. So remove it and use bidirectional relations
From your remark
statusPartner is simply status of the partner before marriage (divorced, widow and so on)
that enforce to manage it through a class-association :
With only partner you cannot know for who is statusPartner1 and statusPartner2, of course you do not have that problem in case of a class-association.
You can also move that attribute in Individual but in that case it exist not only for the partner and that has no lot of sense to have it
So for instance :
Note it is also possible to use only one relation for both the officiant and witness using a class-association :
with a constraint saying there are two Individuals with the role witness and one with the role officiant
The role can also be an enumeration or replaced by the isWitness being a boolean etc.
It is also possible to use only one class-association :
with a first constraint saying the role of a Partner is partner and a second saying at a marriage there are two Individuals with the role witness and one with the role officiant and two with the role partner
Perfectly! But notice that in the beginning there were partner1Witness and partner2Witness, that is, each partner has his own witness.
first constraint saying the role of a Partner is partner and a second saying at a marriage there are two Individuals with the role witness and one with the role officiant and two with the role partner
may be diagramming
Possible scheme in the picture

Use case diagram extend or include for admin relation to customer order

So basically i'm wondering if I'm thinking correctly. In an e-commerce environment does the order of a product have a relationship to the admin use case of managing orders? Once an order has gone through is the admin then going to be able to see the order through a relationship between the 2 use cases. I've provided an image for reference in my case.Here is the image
TL;DR
No, there is no extension here. Those will be two separate UCs.
Explanation
First let me focus on the goal of the Use Case diagram. This diagram is intended to show functions of the system and users (or more broadly actors) engaged in those functions. It is not used to show how data flow through the system or what are steps of the processing. There are other diagrams to do that.
As a rule of thumb, something is a good use case if you can log into the system, perform only the action of this single use case and then log out.
Extends (Includes works pretty much the same, it's just stronger) means that when you run the extended UC you can include the other use case as well. In other words in your specific example when Customer logs to E-Commerce to place an order he can while placing an order also choose to additionally receive and manage order (BTW I would reconsider this UC, you probably have few separate UCs here like Complete order, Dispatch order or Reject order) in which case additionally an Admin is need. Even if you invert Extends, it's still not what you want. Those two UC happen totally separately even though the order processed by Admin is the very same one placed by Customer.
I did not search for too long but I did not find a case where a given use case, associated to one actor, is extended or included by another use case, associated to another actors.
A use case describe the usage of your system by a given actor so you do not have any other actor involved.

UML diagram use case condition

I am creating use-case diagram. I have two actors: user and admin. Admin can check all orders, and user can check only his/her orders.
Should I create two use cases in my UML diagram, or I can use one use case with condition for user actor?
If I can use condition, which symbol must I use? Square brackets or curly brackets?
You need to attach a constraint to either the connector, the use case or the actor (where it's most appropriate). It could look like this:
Note that this is an example and contains redundant constraints which should not be done for a real UC.
I believe you are doing too much as part of your use case analysis.
Use cases are listing what your users (actors) can do and what benefit they get from doing those actions.
Thinking that way, each user/actor will have a set of actions (use cases) that will provide them with a benefit.
In your example, you should have many use cases for each actor, e.g., Admin would be able to create/delete users and provileges (UC1), list all actions from one or many users (UC2) and both would yeild different results.
When you start building your domain and behaviour models, then you will start adding the details of the behaviour.

Confusion in making use case diagram from class diagram

I am trying to make a use case diagram with the help of my class diagram but the problem is i am here confused that what should i take as actors and what will come and what attributes shall i take and where to use <<extend>> ?
Kindly help. Thank you in advance.
As Thomas pointed out, there is no algorithmic way to go from a class design to a use case. In fact, for a given class diagram, it's not even granted that there is a use case at all (for example, if the classes represent only the relation between business objects and no actors).
However, by analyzing your specific diagram from a human point of view, you can very well infer a class diagram:
1) Identify candidate actors
An actor specifies a role played by a user or any other system that interacts with the subject. Candidates in your diagram are: visitor, admin, and registered user
The classes Movie, Book tickets, Make payment are obviously not representing roles of a user.
2) Identify candidate use cases
A use case defines the interactions of a system and an actor in order to achieve some goal. So let's brainstorm a little bit to find everything that looks like an interaction:
Very explicit candidate use cases: Book tickets (class and method of Registered user), Make payment (class and method of Registered user)
Less explicit candidate use cases or interactions: View movie (relation and method of Registered user), update movie (relation), Add movie record (method of admin), Update movie record (method of admin), delete movie record (method of admin), Confirm registration of visitor (inferred from relation), 'Get registered(method of a user),cancel ticket(and method ofRegistered user),Login(method ofRegistered user),Logout(method ofRegistered user),Update Seats available(method ofBook tickets), confirm transaction (method), refund money of cancelled ticket (method)
Implicit/inferred use cases or interactions : create and maintain admin , create a visitor, register and maintain a registered user account, anything else ?
3) Sort out the use cases
Among all the potential use cases and interaction identified, not all should get the use case status. You have then to find which are use cases and which are just interactions part of the same use case. For example:
update movie catalog would be composed of update movie, Add movie record, Update movie record, delete movie record.
Get registered and Confirm registration of visitor are obviously part of the same use case, because the goal is the same: registering a user.
...
I let you as an execise sort out the rest.
4) Review the actors
After having identified meaningful use cases you may want to review your candidate actors:
Some candidate actors might appear to be in fact only objects that are unrelated to users (it's not the case here, but it could be, for example, if you'd have a Movie producer, which is just an info related to a movie but not a user of the system).
Identify obviously missing actors for important use case that you have identified. Here for example, I first thought it was an internet movie business. But the method Update Seats makes obvious that we are talking of a real theater. So who would get the payment from the user, hand out the ticket, reimburse money in relation with the system ? If it's just the online booking system, we are fine. If the cahs desk operator shall use the system as well, then we should add this actor.
Find out relationship between candidate actors. A registered user was first a visitor. Shall we represent both of them in the diagram or not ?
5) Draw your use case diagram
Now you have all the elements, you can make your use case diagram. But you still have to decide on the level of detail you want to represent. Here a proposal:
You can not create a use case from a class design. Only the other way around. Form follows function, not vice versa.
Your class diagram indicates that you are not yet familiar with class modeling. Your classes Book Ticket and Make Payment sound like use cases rather than proper classes. A class is a container of data and functionality working on those data, whereas a use case is a piece of work that an actor performs with the help of the system.
Giving you the help you need might be too broad for this platform. Study introductory texts on UML modeling to get a feeling for what can be expressed by which type of model. And don't feel obliged to use all elements the language offers. There are plenty of use case models that don't need include and extend relations.

An actor performing a use case on behalf of another actor in UML use case

My question is: when there are two actors in a use case, and one performs a specific use case or action for themselves, but there is another actor which can perform that same use case/action for the other actor (with a couple additional steps), do they both point to the same use case?
I have a scenario below:
So, I have two actors: Student and Counselor (Both are Users).
A student can create their own schedule.
A counselor can create a schedule for a student (i.e. on behalf of another student, not themselves). In this scenario, the teacher must also search for a student (which the student does not have to do in their use case). I'm guessing this could possibly << extend >> the "Create Schedule", but again it's only applicable for the Counselor actor.
A use case shall always express the added value the system under consideration creates for the actor. So "... on behalf" does not express the added value. Rather you should model this with a single use case and express the "on behalf" as a constraint. It can be done either by adding a role (the User you named)
Or you can also do it directly like this:

Resources