Search code examples
umlactivity-diagram

Using join node on decision node to minimize redundant activities


enter image description here

Hi, I did an activity diagram for my use case 'Remove Cart Item'. I was wondering if the implementation of the join node is correct for the following scenario : 'When a customer clicks the remove item menu button, the system will validate the input, if it's valid it will remove the item from the cart and redirect the customer to the cart page with a success message, else it will redirect the customer back to cart page with a fail message. I implemented the join node to minimize the redundant activity of redirecting the customer back to the cart page...but i am sure whether it can be used like that or not...


Solution

  • This is not correct: join node is meant for joining forked flow (i.e. parallel flows executing at the same time). Here it would wait for a token to be present on both sides of your decision node: endless waiting guaranteed!

    But you could just replace the join nodes with merge nodes (also a diamond). Merge nodes are meant to merge alternative flows, which is what you want to achieve here. With this correction, it’ll be perfect (at least, it’ll be as you expect).