I've recently been learning about UML use case diagrams and I have a few minor questions about this UML case diagram that I have created.
Does view schedule <<extend>> from create schedule?
If yes, then does this work properly by including the Login?
Is it necessary to <<include>> username/password for the login or should I simply have "Login" without username/pass
p.s. I know this is very basic but i'm unsure about whether or not I've got the hang of this.
Thanks.
There are a couple of issues.
The <<include>> is meant to include UCs, not objects. Since Vehicles/Drivers/... are not UCs that's wrong.
The fact that Create schedule extends View schedule seems odd. To me both are individual and independent UCs.
Finally Login is no (business) UC. It is a constraint which is to be applied to View schedule. Attach a <<invariant>> {must be logged on} to the connector to User
Remember: a UC is about added value for an actor. That's what the UC is named after. For that reason Login is no UC (but a constraint). Avoid include/extend since it is a sign of using functional decomposition. UC is about the opposite: synthesizing work steps that belong to a single added value.
Related
I am new to object oriented design and I wanted to do my first ever UML use case Diagram on a simple application which contains toolbar on the top left corner. The toolbar is called files and when the user clicks on it,a drop down menu is opened with options to open a slide,save slide,make new slide and exit the application.
My question is, am I doing it correct with Use-Case inheritance(Generalization) ?
This is my diagram.
I am sorry to disapoint you, but I have to tell you that this practice is just plain wrong:
From the point of view of the semantics, the use-case specialization means that Open presentation is a special form of Check file, and Save file as well, and that the actor could use them interchangeably and independently. But this cannot be what you mean: exiting a presentation is at best a sub-part of checking a file
From the point of view of the purpose, a use-case should represent a user goal. It's part of the problem space, i.e. what the user wants to achieve. It's not part of the solution space, i.e. how the user will achieve it. A toolbar is not a goal: it's a user-interface element.
From the engineering practice perspective, use-case should not be used for user-interface design. It's not my own statement, but that of Jacobson, Booch and Rumbaugh, the founding fathers of UML:
The problem is that the [use-case] descriptions often contain implicit decisions about user-interfaces. Later, when the user interface designers suggest suitable user-interfaces for the use-case , they may be limited by those decisions.
in The unified software development process, page 164
So in conclusion, it's a bad idea to start use-cases from the user-interface. It locks you into your own design and ignores the user experience. You should focus instead only on the user needs. THe same use-case could then be used whether you'll implement it using a GUI interface, a chatbot interface, or a a voice-based interface.
While drawing Use Case diagram, one thing you should focus on is, the actual meaning of it and the purpose of drawing it.
A Use Case refers to what the users in respect of their type are able to do in your System... Anything inside the boundary is what system is capable of doing or what it can provide as a service to its users.
While naming the use cases, you should only use verbs and actions, for example:
1- Login | 2- Submit a Request | 3- Update Profile Description
You should avoid any nouns in them.
There are several relationships that exist in a Use Case Diagram among use cases, and a relationship among actors and use cases of the system, And They are as follows:
Association: the only relationship that can exist between an actor and a use case; Which says the actor is initiator of this use case, or is the one who is caple of operating the use case.
In the example above, User is caple of loggin in and submitting a complaint.
Include: Use Cases can include one or more use cases. When a use case includes another use case, it means the included use case or use cases happen all the time and are part of the initial use case.
Paying fees is included, because user has to pay the fees in signing up process, it has to be done, and it's part of the baseline path of the scenario.
Extend: When a use case is not happening all the time, and is part of your alternative path ( Alternative path of the complete scnario for this use case ), the use case should be extended to the base use case.
Forget password is extended to Login use case, because it doesn't happen all the time, and it's part of a alternative path of Login scenario.
Generalization: When there exist several different ways that a use case can be performed and completed, we use generalization. The inheritent use cases should all be of the same type as the inherited use case.
Submitting a complaint can be done in several different ways, in this case, we need to seprate each use case and inherit from from the submit a complaint use case which includes paying fees, this shows that, paying fees is a part of every type of complaint which is submitted.
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.
In my UML Use Case diagram I've got 1 actor(User) and 2 use-cases(Login and Registration). They are connected as in image below(Association between User and Login, and Extend between Login and Registration)
I've read on online sources about UML about the relationships in the use-case diagrams, but I have problem in defining Registration use-case. In which situations can Registration use-case be optional and mandatory?
P.S. Feel free to advise modifications to this diagram.
A use case shows an added value the system under consideration delivers to one of its actors. With that respect, Login is no use case at all, since it does not deliver added value. Rather, it is a constraint you can apply to use cases.
Registration is not a good naming for a UC. You should stick to predicate/subject[/object]. So Register for <missing since you did not mention it> is a good name for that UC. And, now that it is a singular UC, you see that it does not extend anything. The use of extend/include is anyway in most cases a sign of functional decomposition. And UCs are not decomposed as added value is a singularity that can not be divided. Remember the caveat: If your UC diagram looks like a spider web, your design is broken (you tried functional decomposition).
I always recommend to read Bittner/Spence to get a good understanding of synthesizing UCs.
Addendum: I said that Login is no use case. And that should be true in general. UCs are usually used in a business environment. However, if you also model UCs in the technical environment, you can have Login as UC. But UCs in a technical sense are a bit awkward. I always recommend to stay on business level with UCs. I think that's more stringent. In a technical environment you do have other means of describing things.
I'm wondering if my use case diagram is about right and if anyone could give me some pointers if it's not.
It's for an application where users can login (always required). When they login they see a list with posts which they can up or downvote (like reddit). When selecting a post they can place and delete(only their own) comments.
The user that's logged in can place posts when logged in, but also has a button to view posts they've already placed where they can be edited and deleted.
Finally there's an admin that can delete inappropriate posts and comments.
Am I supposed to define that users can only edit and delete their own posts and comments? If so, how do I do that? Perhaps a different actor?
Thanks in advance!
There are a couple of flaws in your UCs.
Login is not a UC at all (it does not add any value to the actor). It is a constraint you may apply to UCs.
Wrong username/pw is no UC, of course. It's some message that will pop up somewhere.
Register is a UC on it's own. Connect it directly to User.
Using generalization with UC is not a good idea since it will bring in a lot of stuff for discussion. Leave it at the Manage level and describe inside the UC what this means.
<<include>> is usually used the wrong way (namely for functional decomposition). And you are doing that too. So leave it away, concentrate on the basic UC Manage comments and connect that directly with the actor.
If for some reason you need to describe some order for UCs you can use pre-conditions inside the UCs.
Remember that you cannot model everything using use case diagram. A single UC is a set of action flows that provide a specific business result. You can provide details on limitations (e.g. condition that you can manage only your own comments) in a description of UC (either modelled by activity or sequence diagram or simply in a written description) but not on UC diagram.
As the commenting is optional in your system, definitely you've used incorrect relationship. include means that the included UC will be always executed when executing including UC. In your case this is up to a decision of a user which means you should use extends instead (and of course in this case the relationship is in the opposite direction). See 18.1.3.2 (second paragraph) and 18.1.3.3 (first paragraph). You can also find confirmation of that in almost any book about UML based analysis (e.g. Howard Podeswa's "UML for the business analyst" to name one)
Besides that I agree with the list of flaws given by Thomas Kilian.
In an use case I have two Actor/user:
Patient
Expert
Both of them can do create/view/edit on patient profile. Expert can do them on all profiles,but patient can effect only on him/her profile.
I have to keep diagram clear and avoid from repeating the same things. Now I want to know is there a way to draw create/view/edit once but describe patient's limitations? Or it may be my mistake and it is better to use another diagram to describe limitations of actors? Sorry,but I am new by UML.
In the UML Use Case diagram there is (as far as I know) no built-in way to visually capture constraints. You can show then using the invaluable note symbol:
Although you can model the access right policies using some simple means:
realistic user access rights management will be probably implemented using access tokens, authentication, authorization and all this stuff delegated to another (complex and reliable) system component providing some kind of CanAccess(who, what, CRUD): boolean service to the "system".
In order to capture the various limitations you would typically put them into the precondition part of the Wikipedia: Use case narrative.
In the UML model the limitations would map to constraints and guard conditions shown in the behavior diagrams describing the use case.
See also:
chapter "Describing Use Case Behaviors" in uml-diagrams.org: UML Use Case
A use case diagram is not meant to show the permissions that each actor has to perform particular operations. It is meant to show what the system has to do and who it has to do it for.
In this case, I'd say you have only one kind of actor for this use case diagram: User. And you have the use cases: "User Creates/views/edits".
The exception would be if the Create operation of an Expert is different from that of a Patient (in a way that would be visible on the use case diagram). For instance, if "Expert Creates" also has to perform "Expert Sends Email", then that would be a reason to consider two separate actors.