What is the difference between Join and Merge in Unified Modeling Language Activity Diagram. Give an example to understand more clearly.
Join Node (see reference 1):
Join node is a control node that has multiple incoming edges and one outgoing edge and is used to synchronize incoming concurrent flows. Join nodes are introduced to support parallelism in activities.
Merge Node (see reference 2):
Merge node is a control node that brings together multiple incoming alternate flows to accept single outgoing flow. There is no joining of tokens. Merge should not be used to synchronize concurrent flows.
For example in below diagram:
A decision is used after a fork, the two flows coming out of the decision need to be merged into one before going to a join.
Why?: Otherwise, the join will wait for both flows.
So, Activity 2
and Activity 3
are our alternate flows and only one of which will arrive. And they are not synchronize incoming.
However, the Concurrent_Activity
and result of decision between Activity 1
and Activity 2
(that merged into one output) are synchronize incoming concurrent flows. The join waits for both to perform and continue.