user3167003
user3167003

Reputation:

How to re-use subworkflow in UML activity diagram

I'm trying to model a pipeline in UML as an activity diagram, and I'm not sure how to describe a process consisting of multiple steps, where the user can decide which parts to execute:

-case 1: only A
-case 2: A and B
-case 3: A, B and C (Note: B can not be skipped in order to process C)

But if I put it into an activity diagram, I have to draw each sub-workflow multiple times: enter image description here

So I don't think I'm doing it right. Maybe someone could help me with it?

Upvotes: 1

Views: 690

Answers (3)

user3167003
user3167003

Reputation:

In the end what I was looking for was a nested activity as shown in https://softwareengineering.stackexchange.com/questions/331641/how-do-i-represent-nested-actions-in-a-uml-activity-diagram

Upvotes: 0

qwerty_so
qwerty_so

Reputation: 36313

There are some issues with your diagram:

  1. You are missing the square brackets around the guard. So it should be [Yes], [No], etc.
  2. The middle part of the decision has no guard, so the flow will take that way in any case.
  3. The lower Activity has 3 incoming edges, but only one will have a token. So it will never continue. You need to merge the flows from above prior to it.

Basically you could leave the actions this way. I'd probably pull out A (oh, I see that bruno suggested the same) since it's performed in all cases. So your decision will be left with two outputs. Although from a "physical view" your decision is made first (the user has to interact) will be after A has already been performed, the output/consequences will be the same. So this is kind of a business decision.

Upvotes: 2

bruno
bruno

Reputation: 32596

it is ok except that yes/no is not enough to separate three cases :-)

you can also move the test after A being executed in all case

Upvotes: 1

Related Questions