Is this a correct use case diagram? - uml

I'm trying to write an use for shopping online . Customer can search for their desired item and add them to the shopping cart,but when they decide to check out, they need to log in with their account. But what happen if customer already logged in ? Is my diagram still correct ? If not, How can I modify it ?

Any use case must be connected to some actor(s). So, you should add connections.
The CheckOut use case is strange and inunderstandable. I don't know any action in net stores, that includes both login and payment. If you mean ordering, the login or payment are additional separate use cases, that are connected to ordering by some conditions that could be described as states.
Don't forget, you can't show sequences of actions and states by use cases elements only. If you have a small use case diagram, you could include state machine diagrams in it, but here it is not good - You have totally forgotten the admin and seller actors and their use cases, so the full use case diagram will be too large to add something extra in it. Describe sequences about logging in additional State Machine diagrams.

You are trying to use the use case diagram as a workflow editor, which is incorrect.
Use case diagrams are used to indicate the actions that a user can take to accomplish something. They do not represent the sequence of these actions. Each use case starts from a specific user action, and not as a side effect of another use case.
In your diagram, the "Search" use case is fine, but the display of the result is part of that use case. It would not be very useful if the system would just display a "search complete" result and then force the user to do some action to view the result... Although you have an <<include>> relationship, that it not what it means.
One example for <<include>> is one for a Login use case. The Customer could login on their own before doing anything else or the login could be triggered by another use case, such as Check Out. Login would therefore be a use case on its own and it would also be <<include>> by the Check Out use case.
Add to Cart is a use case that should be triggered directly by the Customer. It is not something that is triggered automatically - the Customer needs to do something.
The same applies to the Make Payment use case. I would think that the Customer needs to perform an explicit action in order to pay.

Related

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.

How Should Conditional Paths for Use-case Diagrams be Modeled?

I'm making a website where the visitor can:
View posts.
Only use regular or Facebook registration if they're not signed in.
Only login with Facebook if they've registered with Facebook.
Only use regular login or password reset if they've registered in the regular way.
Only create posts or unregister if they're authenticated.
I don't understand how I should model the different use-cases available for the visitor. Since an unregistered visitor can become registered visitor and a registered visitor can become an unregistered visitor, they can do the same thing on the site, they just take different paths.
Are these conditions important for a use-case diagram? Is it too specific to say that regular registration requires many fields to be filled in, while Facebook registration only requires the visitor to choose a username?
Can a use-case extend itself? Like if the registration fails, the visitor repeats the registration again.
Edit: I made a guess how to do the diagram:
Edit 2: Or maybe simpler like this?
As #granier said, Your second model is far better and #Thomas Kilian's points are remakable.
I want to say your mistakes and offer a new Use Case Diagram. I think there are some mistakes in your models (Logically and Practically):
Too detailed Use Case Diagram (model 1) (please see my previous post TIPS here)
Username is not Use Case.
There is not extend relationship between Login and Reset Password. (model 2)
Login associated with registered user? All users can trigger Login Use Case (even successful or not).
Wrong uses of include and extend and inheritance relationships (model 1).
Please consider my offered Use Case Diagram:
Additionally, you can add pre-conditions and post-conditions to your use case documentation. But, they do not change the Use Cases.
Your second model is far better. Use Cases generalization is not used often even in specification an exemple is provided. .
Since the user should be able to register, the actor "Unregistered User" could be removed. No ?
I use Use Cases generalization in one case only : when i want that several Use Cases get the same includes or extension.
There is nothing wrong with showing constraints as you did it. What I do is usually to create an overview diagram like your #2. And then focusing on single use cases showing just their relations to actors and requirements - and eventually constraints derived from the latter.
Don't fall in the trap of functional decomposition and avoid <<include>>/<<extend>> or even worse generalizations. Use cases are not used to decompose functional parts but synthesize them. A use case shows a single added value the system under consideration delivers to one of its actors.
Login is no use case since it has no added value. It is a constraint which you can attach to use cases.
As always: the UML specs are no good read to understand Use Case synthesis. It's written by eggheads with little business background. Look into Bittner/Spence instead.

Extending a view items usecase

Suppose I have a use case with the name "View Items" that shows a list of items to the user. The user may optionally select a specific item to view its details and then back to the list again.
Should "View Item Details" extend "View Items" or they are stand-alone usecases?
Based on Extending definition here:
Extend is a directed relationship that specifies how and when the
behavior defined in usually supplementary (optional) extending use
case can be inserted into the behavior defined in the extended use
case.
For example (in that reference):
Registration use case is complete and meaningful on its own. It could
be extended with optional Get Help On Registration use case.
Meaning that, in Registration Use Case and in it's behavior, we may need to perform Get Help On Registration Use Case too.
It seems only a link, but it is not just a link to Get Help On Registration Use Case (we may need it to perform Registration).
For another example (from this question):
Suppose that we have Answer the Question Use Case and Research the Answer Use Case. To perform Answer the Question Use Case we may need to perform Research the Answer Use Case too. (And also this is not only a link)
For another example:
Suppose that we have Enroll in University and Perform Security Check Use Cases. To perform Enroll in University Use Case we may need to perform Perform Security Check Use Case too.
In Extend:
A behavior extends another if it is in addition to, but not necessarily part of the behavior.
Therefor: In your example to perform View Items Use Case we do not need to perform View Item Details Use Case too. In other word, in the steps of View Items scenario, we do not need to perform (or optionally) View Item Details scenario. They are stand-alone Use Cases.
I simply ask: does it add value? If yes, then just make it a stand alone use case. The use of <<extend>>/<<include>> usually indicates that someone is trying to do functional decomposition. I regard the introduction of these relations as bad move in UML which is likely sprung out of a technicians head than a business person. Added value can not really be sub-divided. Either it is, or is not.
"To add value, that is the question", and "There's something rotten in the state of UML".

Mapping validation and checking availability to a use case diagram

In a use case diagram for a web based hire system that I have, the following two functionality were required.
1. To validate a user's login before carrying out a payment function.
2. To check the availability of a certain tool and a time before the user is allowed to hire it.
So, for Case 1, I believe the following is correct. Is this the proper use of an include condition, or is there some other use as well?
An actor has an association with a MAKE PAYMENT use case. An include statement is drawn from the MAKE PAYMENT use case to a VALIDATE USER LOGIN use case.
For Case 2, I mapped it like this. However I feel that this isn't correct.
An actor has an association with a CHOOSE TOOL use case and a CHOOSE TIME. An include statement is drawn from them to a CHECK AVAILABILITY use case.
I think first that the two use case to choose might be more accurately depicted in a single use case, but I can't think of how the availability is to be mapped. Should it be in the specification only?
I would post diagrams, but I don't have enough reputation to.
Welcome to Stackoverflow.
Make "Validate user login" a precondition to "make payment", i.e. do not make it an extra use case. The user will not validate that he himself is logged in, the system does that for him and it's trivial. The precondition is noted in the use case description.
"choose tool" <<include>>s "choose time". That is what the user needs to do, while
"check availability" is what the system does for the user. So that goes to the use case description as well, and is not a use case of its own.
"make payment" <<extend>>s "choose tool", of course.

Resources