0

Question

When an alt frame is used in a sequence diagram, and one of the two possibility end the sequence, how is "legal" to continue?

example

I need to represent a sequence in wich there are user and atm

  1. the user insert card
  2. the atm verify card
  3. if card is valid, then it confirm card to user and the sequence continue
  4. if not it to user and the sequence Stop

can someone represent this simple example?

I made this sequence:

image

Is correct?

I assume that the part follow the alt frame imply that "good" case is verified?

Or I need to put all of the sequence of "good case" in the "good case alternative section"?

how can I handle this situation?

Thank's in advance!

  • As a side note: it should be ask for PIN rather than insert PIN. And invalid card should be a return message (dashed line). – qwerty_so Sep 8 at 22:19
  • 1
    With system sequence diagrams (actor vs system), I prefer a separate diagram for each scenario. That is, one with the "happy path" and another for the "invalid card", etc. I find alt/if/else very difficult to read, especially when there is complexity in the branching. – Fuhrmanator Sep 9 at 22:57
3

I assume that the part follow the alt frame imply that "good" case is verified?

No, that assumption is incorrect. The part following the alt frame will be done when either part of the alt frame completes.

Or I need to put all of the sequence of "good case" in the "good case alternative section"?

Yes, all the steps that belong to the "valid card" alternative of the alt frame need to be shown within that portion of the frame.
If that clutters your diagram too much, you can also draw a seq frame inside the alt frame. The seq frame contains the name of another sequence diagram that describes the steps happening at that point.

Another option is to use a break frame. That would contain the steps for an invalid card (with a guard condition). Either the content of the break frame is executed, or the part of the sequence diagram below the frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.