Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to model optional actions on UML activity diagram

After searching the net and a couple of old fashioned books I own, I still haven't found my answer to how to model an activity for a specific use case. I am fairly new to UML and thus activity diagrams.

The activity is Add hotel. This is fictional, but the issue is exactly the same as my issue. My contract prevents me from talking about the real deal to third parties.

In this activity the user provides necessary details and has two optional actions that he can choose at anytime while in the Add hotel activity:

  1. Add hotel chain
  2. Add loyalty program

As said these are optional and not mandatory. The user is also able to proceed to save the entered data. However, when choosing one of these actions, I imagine another activity diagram should be invoked, named the same as the choice the user made. In this activity all relevant stuff is entered and at the endpoint the user returns to the Add a hotel activity after which the user has the option to choose the optional activities again or proceed to save the provided data.

The only somewhat relevant answer I found was this one

But as I understand it, a fork means all actions after it have to be carried out before the flow will continue after the join. And in case of a decision, only one option can be chosen.

The actions 1 and 2 above, are also available from other locations in the application. I just need to make them available on the Add hotel activity.

So how would I go about modelling optional actions that are available all the time during the flow of an activity? And why should it be done that way (if not obvious after reading) Also, does it matter if these optional actions are Atomic actions or CallBehavior actions?

Like is said, I'm fairly new to UML, so it might well be possible that I interpret some things wrongly.

like image 222
Michael Albers Avatar asked Apr 29 '15 21:04

Michael Albers


People also ask

How do you represent an action in UML?

Actions are notated as round-cornered rectangles. Name or description of the action is placed inside of the rectangle. The Process Order action. Name of the action is usually action verb or noun for the action with some explanation.

Does activity diagram contain action?

Activity diagrams show the flow of control and activities as rounded rectangles. Activities are typical action states – states that transit automatically to the next state after the action is complete. The filled-in circle represents the start of the activity diagram where the flow of control starts.

How do I use Staruml to draw an activity diagram?

To create a Activity Diagram: Select first an element where a new Activity Diagram to be contained as a child. Select Model | Add Diagram | Activity Diagram in Menu Bar or select Add Diagram | Activity Diagram in Context Menu.

Can activity diagram have two start points?

The initial node is the starting point of an activity. An activity can have more than one initial node; in this case several flows start at the beginning of an activity: It is also possible that an activity has no initial node, but is initiated by an event (action: accepting an event).


1 Answers

You're correct in the assumption that a fork will continue in all paths. To make an optional process simply use a Decision node (looks like a lozenge). From there you can proceed to your two optional actions or skip. Finally join the path again with the very same lozenge to merge the optional paths.

Basically it might look like this (not taking all the details of your activity into account):

enter image description here Just ignore all those fuzzy details about different actions. Atomic is enough for a start.

like image 188
qwerty_so Avatar answered Oct 08 '22 23:10

qwerty_so