0
votes

For example, the user can perform action A, action B or action C in a tool. Whether they choose A, B or C, the order of these actions and how many times they are repeated is up to the user and the reason why they choose A,B or C and why they are chosen in a particular order isn't clear. Also any action can be repeated again after another action has been done by the user.

EDIT: A more concrete example would be the creation of an image. The user can draw a shape, choose a new shape, choose a new colour and save the image. While drawing these 4 actions can be performed intertwined in any random order and in any random quantity, only guided by the whims of the user. There is also the choice of creating a new image from scratch or editing an existing image to create a new image.

4

4 Answers

2
votes

Very simple solution to you question is below.

enter image description here

Please do not omit the guards after decision node if you don't want to have an undeterministic behaviour of your activity. Decision node offers a token to the first flow that have true guard whereas the order of evaluating of the guards is not defined.

2
votes

When modelling anything using any notation, it is important to remember what the purpose of is in creating the model, and who is going to use it.

If you simply omit the guards on arcs, then the model has no information describing how the system behaves. It cannot guide another developer to create the software, it does not record the intent of the designer.

The user is outside the system boundary, so the decision as to what action to perform is elsewhere. The system behaviour should be modelled as a condition of its state, inputs or events - these are what the system can operate on, and what developers expect to find in the UML model to guide them.

The exact UML construct used will depend on how that choice is communicated across the system boundary - an activity diagram may well not be the best way of communicating that, or you might use multiple diagrams for each interaction

The software being modelled does not make an unconditional choice, and the information in the model should reflect that with enough detail to be useful to the next person viewing it.

-1
votes

Normally a loop node should help you to solve your problem. If the flag isTestedFirst, the loop node is a while-do loop.

However this is not the easiest node of activity diagram.

It has three part : the setup part, the test part which is test at each iteration and the body part.

Maybe this image extracted from sparx documentation may help you : loop node

Hope this help and maybe someone else may provide more details.

-1
votes

Well, you just leave away the guard:

enter image description here

Now the path can take any way. However, since there is a choice, it's the user taking the action and choosing the path he likes.

Edit Thinking a bit about the "natural" control flow it seems obvious, that preceding the ConditionalNode you find an action like Offer choice (e.g. in the concrete example of the OP: "draw", "choose shape", "choose color", etc.). So the outcome of the ConditionalNode is one of the users choices which in turn should have an appropriate guard. So the above is merely a sketch and can be regarded as incomplete. However, presenting this sketch to a reader would either make him "aha" or ask the question that came up my mind after thinking a while. Regardless of this, there will be just one path been taken after the ConditionalNode.