what should i use an include or an extend - uml

Consider the following situation. I was unable to find a great answer.
I have a use case A. After executing it, one of two possible use cases will be followed:
Execute use case B
Execute use case C
What should I use? A include B and A include C? OR B extend A and C extend A?
I am not sure, because C and B are potentials here. One of them have to be done.
All help is appreciated.

I am not sure that use Use case is the right way for modelling an alternative.
If you create an include between two uses cases this means that the source of the include link will always be included when do target of the include.
If you create an extend between two UCs this have more or less the same meaning that a generalization between two classes i.e. the target of the extend is a generalisation of the source.

Based on your example use case A "Compose a number" ( on the phone ) then you have 2 possibilities whether use case B"call the number" or use case C "delete the number"
the right choice is to define use case A and B as main use cases both including use case A :
UseCase B \
--include--> UseCase A
UseCase C /
Use case should be defined by actor goal, in your examples the goal of the actor are to call the number or to delete the number.

Related

can one use case be EXTENDed from more than one base use case?

I have this use case, suppose named A, which is in nature an extension of both use cases B and C.
Is there a standard way to illustrate this?
For example is this true?
In UML, you can have an extension of several main use cases at a time without problem.
As for the link you provide, I'd connect the actor to B and C instead of A, because B and C are the "main" use cases. The actor that launches A is the actor that performs the main use case. In this way you could even have a different actor for B and C, and naturally A would be done by one or the other depending on the main use case.
A use case extends 0..* use cases, and is extended by 0..* use cases, but note that the arrow is drawn from the extending use case to the extended use case. In your diagram there is a single base (extended) use case, namely A.
An extend relationship between use cases is shown by a dashed arrow with an open arrowhead from the use case providing the extension to the base use case [UML/2.4.1/Superstructure§16.3.3].

UML : including use cases of different users?

Is it legal to draw up an include relationship between two use cases that are each associated with a different actor?
Yes this is legal, but I think it should not interpreted as #vainolo suggested.
Suppose this scenario
In this case Actor X has direct access to Use Case A and because Use Case B is included by Use case A Actor X also executed the behavior described in Use CAse B
But only Actor Y has direct access Use Case B.
Actor A only has indirect access through Use Case A
At least that is how I interpret it. The UML specs will only tell you this is a valid UML syntax but will not say much about the meaning of such a scenario.
It's completely legal. What this means is that if the including use case calls the included use case, the actor that is connected to this use case is required.

Can I include the included in a UML use case diagram?

In UML, when drawing a use case diagram, can I include the already included use case? (Or extend the already extended use case?)
Does it make sense? I have such a situation where I think I can include B in A and include C in B; where A, B, C are all use cases.
A ----------------> B ----------------> C
<<include>> <<include>>
Dose it technically make sense?
Technically, it is possible to do what you mentioned, if it fits your scenario. But just remember, use 'include' usually to abstract sequences of steps out of the primary Use Cases that are helpful to the analyst to avoid repetition. This means it comes into picture after you have completed at least the first cut basic flows for all your main Use Cases. The main purpose is to simplify your use-case diagram, not to complicate it.
It depends on whether the usecase A is being called from C directly and not within the scope of B. If A is being used by C directly, then it makes sense to draw that in your C use case and qualify A as included. Else you could ignore.

Actor in UML (Use case)

Lets say i have Use Case A (Cancel Consultation),B (Destroy Patient Image) and Actor C (Patient).
Use Case A includes Use Case B, and Actor C triggers Use Case A to happens. My question is, do i need to add a <> from the Actor C to Use Case B ? I was thinking ,Use Case B happens only if Use Case A fires, which means Actor C ONLY triggers Use Case A.
Not so sure that if Use Case A includes Use Case B, and Use Case A triggers by Actor C, therefore Use Case A and B has the primary actor of Actor C ???
From description I'd say you don't need a relation between Actor C & Use Case B.
Rationale: A link between an Actor and a Use Case should represent a meaningful unit of value to the Actor. From your description, "Cancel Consultation" is that meaningful unit of value; it's what the Patient sets out to accomplish.
Destroying the image is a necessary requirement of cancelling the consultation. However - at least in this example - the Patient doesn't set out just to destroy the image. Hence no link between Patient & Destroy Image.
Of course: that could change. As you explore the domain, you might find a scenario in which it's valid for a Patient (or perhaps another Actor) to destroy an image. Perhaps a Radiographer would destroy an image if it didn't focus correctly (dunno, I'm making this up).
All comes back to the User intent. You should link Actors with Use Cases that capture their goals, not sub-steps within those goals.
hth.

Use Case relationship

can two use cases extend or include each other at the same time?
A extend/include B and B extend/include A
I'm pretty sure the answer is "NO".
You've just described the digital equivalent fo the chicken and egg problem.
Circular references are [almost] always Bad Things (tm). The only place I know it to not be horrible is in the context of a linked list, in which each entry has a pointer to another of its own type.
If (A includes/extends B and B includes/extends A) then A = B
Admitting that if A extends/includes B then A >= B
It seems likely not, though I'm sure you could do it if you went generic [and useless] enough. Do you have a specific example? There are always exemptions to the rules and I'd be curious to see one.
below is the senario for business use case (business modelling) not system use case:
USE Case A: Service Vehicle
Use Case B: Authorise Additional repair
Use Case C: Repair Vehicle
Additional repair could be identified during initial repair.
or repair could be identified as a new repair during service,
in both case, customer authorisation is required?
A extend B and B extend C (authorisation and start of repair identified during service)
C extend B (authorisation for additional repair identified during repair)
It's rare but in the general case, there's nothing that prevents use cases from including/using each other.
the answer is no. extend and include are mutually-exclusive relationship types. Most likely the use-cases are incorrectly factored/separated, or you've misunderstood the extend/include relationship definitions, or both.
given the example you posted (fyi it is better for you to edit the question rather than post an answer that does not answer the original question) i would venture that B extends A and B extends C, since in both cases A and C additional repairs (case B) may be identified.
alternately, use cases A and C could conditionally include use case B
offhand, i would model this as Work On Vehicle, which is a composition of 2 use-cases, Obtain Customer Authorization, and Service Vehicle, where the latter includes any kind of service or repair and requires the output of the former before starting the work. The notion of 'additional repairs' is just another instance of Work On Vehicle.
but i don't know the full business context, so your mileage may vary ;-)
EDIT: you wrote "but in this case: work is being carried out and further authorisation is required during the course of work", but i don't see how that really matters.
the first step is to eliminate the confusion about includes and extends. Try modeling each use-case completely and independently, and then look at what is common to see if includes/extends is warranted
"YES" - Checked the Spec.
I just read through the UML specification section for use cases:
http://www.omg.org/spec/UML/2.1.2/Superstructure/PDF/
There was no rule that would prevent doing this that I could find. Many people may conceptually have a problem with this, but that is ok, as you are just instinctively trying to objectize or structure use cases logically. Use Cases are a behavior (or set) and are not like classes/"objects". We are not talking about Java objects.
Even in Rational Software Modeler (IBM) allows this "circular reference".
In practice and in trying to map this to Java or other Object languages it may not make sense or get confusing.

Resources