Search code examples
umlactivity-diagram

How to represent repetition of activities in Activity Diagram


I have a situation in which, for a given number, I have to repeat a couple of activity for as many time as the given number is. How can I represent this situation in UML using Activity Diagram? I thought I could use expansion regions but I can't figure out how.


Solution

  • The most basic way to is a loop showing the repetition: use a decision node and a flow looping back to a merge node.

    Alternatively, you could represent the loop with an expansion region. Use the keyword <> and expansion nodes to link the inside of the region and its outside. You can find an example in section 6 of this article

    However, in principle an expansion region is used to process a collection in input:

    If the value is iterative, the expansion executions must occur in an iterative sequence, with one completing before another can begin. The first expansion execution begins immediately when the ExpansionRegion starts executing, with subsequent executions starting when the previous execution is completed. If the input collections are ordered, then the expansion executions are sequenced in the order induced by the input collection. Otherwise, the order of the expansion executions is not defined.