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.
Related
I'm working on a module for a larger solution.
In this solution they tried in the past to work with DDD.
However that didn't turn out how it should of been because there was no DDD expert. (and there still isn't one present imo.)
Everything was under a single root aggregate, lazy loading was enabled, and so on.
Now for the new module we want to make it better.
However i'm failing to see how i can use DDD without lazy loading and not drain the entire database.
For example i have an object let's call it "B".
B has a flag let's say "AwesomeFlag"
B has children
If one of B's children is Awesome, then B is awesome as well.
If none of B's children is Awesome, then B isn't awesome.
Now if I would not work with DDD; I'd just get B and execute a linq query that check's if one of B's children is awesome without actually retrieving all of the children.
However if i got a domainobject where i am not allowed to perform queries, how can i do this?
Is DDD forcing me to get all of B's children just to get the calculated flag "IsAwesome" to work?
Or how am i supposed to do this correctly in a DDD environment?
A small hint in which direction i need to focus my research on would be appreciated.
UPDATE
As I was a bit broad in what my question is I'd like to rephrase whilst still using the same terms to be consistent.
B is awesome when one of it's children is awesome.
B itself, does not have a flag "awesome" as this is a calculated field based on the children.
B could have quite a few children, with the children each having allot of properties and data, which you do not want to retrieve just to check if one of the children is Awesome.
B has a method ShouldIBecomeADeveloper
If one of B's children is awesome, making B awesome, it should return a boolean "true"
If none of B's children are awesome, making B not awesome, it should return a boolean "false"
Disclaimer: although this is somehow a valid question, it is very broad, thus it may have many different valid answers.
You need to analyze the business requirements regarding the valid states in which the system is allowed to be. For this you need to answer the question: after a child of B becomes awesome, how fast needs B to become awesome as well?
There are two answers:
Immediately, in a strongly consistent matter. This means that the "awesome mutation" of a child of B and the "awesome mutation" of B are performed in an atomic fashion, they are in the same transaction. In this case you must load B and all its children before mutating one of its children awesomeness. The children of B are nested entities inside the B Aggregate.
It can be delayed, eventually changing its awesomeness to match the business rule, that is, the system can be for some time in a temporary invalid state. In this case, the children of B are also Aggregates. You need a way of mutating B when one of its "past childrens" mutate and for this you can use a Saga/Process manager.
In neither of the two cases you don't use lazy-loading, there is not such thing in case of DDD Aggregates. You can't anyway, if you have pure Aggregates, with no dependencies to Repositories (as you should).
B itself, does not have a flag "awesome" as this is a calculated field based on the children.
Even though "awesome" is a calculated field any operation you perform on the child entity has to go through "B" only, as it is the aggregate root. So you could have a state in "B" called numberOfAwesomeChildren and a child can become awesome/not awesome only when some operation happens on it and since all the operations are directed via "B" only, you can update the numberOfAwesomeChildren whenever a child becomes awesome/not awesome.
So "B" is awesome when numberOfAwesomeChildren is greater than zero.
Even this solution won't solve your lazy loading problem, since to perform an operation on a child entity you will end up loading all the child entity. You may have to have a re-look at your design.
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].
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.
I do not understand well following topic since it is a bit ambiguous from what I read:
Inlcude is like a reference to next part, the usecase is not completed without it. This part should be referenced from more places otherwise its use has no sense.
But I have seen an example when there is "include" only in some IF statement is true, like:
Add new product--->include--->Add new manufacturer. //Adds only when doesnt exist. Why there isnt "extend"? Is it because somewhere else could be "Add new manufacturer" used once again?
Thanks
Exactly. Once you extend another use case you've reached the end of your current use case. However, you can have extend inside an if. Imagine the following.
1) The driver asks if his guests want Wendys or Burger King
2) The guests choose they want Burger King [extend to eating at Burger King (use case 5)]
3) The guests choose they want Wendys [extend to eating at Wendys (use case 9)]
An include doesn't end a use case, it uses another use case and then returns. An include is similar to a function call. You perform the actions in the other function and then you return and continue. You can also have an include without an if statement.
1) The driver orders the food
2) The driver drives to the first window
3) The driver pays the cashier (include handling a credit card transaction (use case 3)]
4) The driver drives to the second window
5) The driver gets the food
Notice that in the above an extend wouldn't work. This is because the driver still needs to go to the second window and get the food. If we extended to use case 3 then we would never return to this use case.
Here's an explanation from the following topic: UML Use Case Diagrams: Reference at http://msdn.microsoft.com/en-us/library/dd409427%28VS.100%29.aspx
Include: An including use case calls or invokes the included one. Inclusion is used to show how
a use case breaks into smaller steps. The included use case is at the arrowhead end.
Extend: An extending use case adds goals and steps to the extended use case. The extensions
operate only under certain conditions. The extended use case is at the arrowhead end.
Include and Extend relationships on a use case diagram http://i.msdn.microsoft.com/Dd409427.UML_UCOvStructure(en-us,VS.100).png
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.