2

While I am following an object oriented course, I am faced with a statement that is kinda strange. I couldn't understand why we would remove UC4 from the given image.

Given Example

And if it is wrong, then similar UC which is below (Download Docs) also must be wrong?

Internet Result that is containing same error I guess

Please tell me what's wrong with this <<include>>?

www.admiraalit.nl
  • 5,768
  • 1
  • 17
  • 32
Umut
  • 27
  • 3
  • Probably because UC4 is not a UC but a functional decomposition. Can only be guessed, but that's a common mistake. Read Bittner/Spence to really understand UC synthesis. – qwerty_so Mar 29 '23 at 21:27
  • See https://stackoverflow.com/questions/65072481/use-cases-extends-and-include – qwerty_so Mar 30 '23 at 07:59
  • Another reason is that UC4 is not connected to any actor and thus not a UC. – qwerty_so Mar 30 '23 at 09:35
  • Your 2nd example is a bit silly. _Upload docs_ extends _Upload docs_. What? And _Login_ is no UC here. What is the added value for _Site user_? "Hey, boss. I've logged in 100 times. Give me more money!" – qwerty_so Mar 31 '23 at 08:20

2 Answers2

1

You do not have to remove UC4 to be UML compliant (it is not wrong), but it is good to remove it for a different reason (best practice). Let me explain.

Eventually, every use case must be further specified, using plain text and/or using diagrams, in order to specify the flows of events (the steps in the user-system communication).

Several use cases may have partially the same flows of events. Without using «include» relationships, you would have to specify these flows in each of these use cases. To avoid duplication of specification (and thus the danger of inconsistencies), you may factor out the duplicate specification in separate "use cases" and use «include» relationships to indicate which use cases share which flows.

By the way, the "use cases" representing the shared parts of other use cases, may not be complete use cases in themselves, therefore I write "use cases" in quotes. Such an incomplete "use case" is not directly associated with an actor in the use case diagram. Personally, I think this should be allowed, but this is debatable.

In your example, the «include» from UC3 to UC2 is fine, because it avoids duplication of the UC2 flows in the specification of UC3.

However, the «include» from UC3 to UC4 makes no sense, because you could include the UC4 flows in UC3 and then remove UC4. This «include» relationship does not avoid any duplication of texts or diagrams.

Yes, the same applies to the «include»-relationship from "Search docs - full text" to "Download doccs".

For more information, see "Master the Use Case Include Relationship"

www.admiraalit.nl
  • 5,768
  • 1
  • 17
  • 32
  • 1
    You describe include as being functional decomposition. That's just not right. A UC is a UC. And only if it is one you can include it. If it's just a flow of events then it's a flow of events. This is a huge difference. – qwerty_so Mar 30 '23 at 20:32
  • 1
    @qwerty_so Avoiding duplication of flows is different from functional decomposition. There is no consensus in the community whether this is good practice. Personally, I think it is better to factor out large common flows in separate "use cases", to avoid inconsistencies, duplication and to visualize the fact that these commonalities exist. But you are right, such a use case may not be a complete use case in itself. I have added the paragraph "By the way.." to clarify this issue. And I have added a link to a blog post that supports my view. – www.admiraalit.nl Mar 31 '23 at 07:18
  • Actually I'm quite happy to see that (at least it looks like that) teaching of UC formalism seems to target this debateable area. I still think that UC should be left to just actor goals. For the _Find_ examples these half-breeds could be looked at as goals. But one should basically not think about function deduplication in the UC synthesis phase! That shall be left for later. – qwerty_so Mar 31 '23 at 08:17
  • Ah, the _Download docs_ probably misses an association to _Site user_ since that seems clearly a goal. – qwerty_so Mar 31 '23 at 08:24
1

The first diagram tries to recommend good practices:

1. Avoid useless specialization

Admin seems to have no relevance in the diagram, since it only inherits the association to use-cases of Member and has no other association. So it seems to add no meaning to the diagram:

  • Pros: the temptation of adding unnecessary knowledge might lead to diagrams difficult to read, whereas additional actors are not in anything different when interacting with the system.

  • Cons: the diagram is not all; sometimes Admin can be used in constraints, or in the use-case description , e.g. "a Member can only see own ratings, except for Admin who can view the ratings of everybody". So in some rare cases, the additional specialization can make sense.

2. Avoid use cases with no actor

Use-cases represents a set of behaviors that help some actors to achieve some goals. Absence of actors then suggest that this UC corresponds to no real need, or that the intellectual effort to identify the actor was not done:

  • Pros: isolated use-cases often represent something that is not really a use-case, e.g. Modern user interface, Fast response time, Date-picker. Sometimes, the actor was just not identified. In the last 25 years, I have never encountered an isolated use-case that was really justified.
  • Cons: it is not forbidden to have a use case without actor. According to UML 2.5.1, a use-case "specifies a set of behaviors (...), which yields an observable result that is of value for Actors or other stakeholders". So, the goal of use-case can be a goal of some-one who doesn't use the system. Moreover, "Each UseCase specifies some behavior that a subject can perform in collaboration with one or more Actors" - it's a possibility, but not an obligation as implied by section 5.1. that explains how the word "can" shall be understood.

However, an other stakeholder can only benefit of the system's observable results if someone or some other system brings it to his/her attention. So there should be an actor that was not identified, and hence the pros really dominate here.

3. Avoid including use cases with no actor

This recommendation is an stronger extension of the rule 2: no actor, no real purpose.

  • Pros: this rule may prevent use-cases that are not driven by the value for an actor.
  • Cons: this rule is very theoretical, since many modelers understand that the actor of the including use-case is implicitly also actor of the included use-case. This is why you'll often see diagrams, like diagram 2.

So this recommendation is not really justified. I'd be more provocative and say to avoid includes and extends at all, since it makes diagram more complex, and often leads to undesirable functional decomposition.

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • 1
    And not to forget: include/extend is most of the time used for functional decompostion (since it seduces the analyst to use it for that). My POV: bad UML design by OMG here. Obviously introduced by coders, not by business people. – qwerty_so Apr 01 '23 at 20:58
  • 1
    @qwerty_so I believe that this has more to do with inertia than the OMG performance. The root of the problem was probably the early days of UC [when they were invented](https://dl.acm.org/doi/10.1145/38807.38824) at Ericson and more seen as a behavioral block (set of successive interactions), which leads to functional decomposition. Some industries have heavily invested in such modelling, and I assume their representatives in OMG have defended the functional view to stay in the UML standard, even after everybody agreed that value/goal driven approach made more sense (my own speculation). – Christophe Apr 02 '23 at 10:05