Dr. Debasish Jana
Dr. Debasish Jana

Reputation: 7128

UML activity diagram for showing a two-pass algorithm

I want to show use of same algorithm as a black box in two-pass iteration. In first pass, I would pass a value of a flag f as false, and an array of one element as A[1..1], output of first pass would be B[1..N]. In second pass, same algorithm would be used with f as true (to indicate second pass) with an input of A[1..N] (fed from output B[1..N] of first pass) whereas the output of second pass would be B[1..M] Please help me drawing the UML Activity diagram for the same. enter image description here

Upvotes: 1

Views: 450

Answers (1)

qwerty_so
qwerty_so

Reputation: 36313

It's not a good idea to try "programming graphically". The algorithm you describe is better shown in meta code than in an activity diagram, as you already have seen. So what I'd do in your case is to have a single Action (representing most likely some CallOperation of some class. And the according behavior of the operation contains the description in either meta code or plain text (as you already stated above).

If for what reason ever you really want to "program graphically" you would need to use single actions for the assignments of the flag like this:

enter image description here

The A and B arrays would be just mentioned in the description of the single actions. To actually show passing the A and B arrays you would need to add ActionsPins or Objects with ObjectFlows between the single Actions. Honestly, that would make the whole thing even more unreadable and hinder more than helping the reader:

enter image description here

Upvotes: 3

Related Questions