Using Alternative Combined Fragments in Sequence Diagram

An alternative combined fragment is used to specify an area of a group of lifelines/ actors to show conditional flow in a sequence diagram. It also models the if-then-else logic in the sequence diagram. In this page, we will demonstrate how to draw a simple sequence diagram with applying alternative combined fragment.

  1. First of all, create a sequence diagram as follows:

    Sequence diagram

    Sequence diagram

  2. Secondly, click Alt. Combined Fragment on the diagram toolbar and drag it on the diagram to cover the Person lifeline and ATM Machine lifeline.

    Create an alterative combined fragment

    Create an alternative combined fragment

  3. Next, draw a message from ATM Machine lifeline to Person lifeline in the upper compartment of the alternative combined fragment. Name it as Ask for password. Draw another message from ATM Machine lifeline to Person lifeline in the lower compartment of the alternative combined fragment afterwards. Name it as Display invalid card.

    Draw two messages

    Draw two messages in alternative combined fragment

  4. Now, Right click on the combined fragment and select Open Specification… from the pop-up menu to open Combined Fragment Specification dialog box.

    Open Specification

    Open Specification

  5. When the Combined Fragments Specification dialog box unfolds, open the Interaction Operands tab, select Operand and then click Open Specification… button. In the Interaction Operand Specification dialog box, open the Guard tab and enter Valid card in Constraint text field. Click OK button to confirm the changes.

    Enter Valid card for Operand

    Enter Valid card for Operand

  6. Similarly, enter Invalid card in Constraint text field for Operand2by following the previous step.

    Enter Invalid card for Operand2

    Enter Invalid card for Operand2

  7. Finally, guard conditions are displayed in the alternative combined fragment as shown below:

    Guard conditions are displayed

    Guard conditions are displayed

How to try the sample

Download ATM machine and then unzip it to get the .vpp file.

2 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply