Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Traces in sequence diagrams

I am struggling with traces in sequence diagram. I have the following sequence diagram:

enter image description here

My book says that there are 2 possible traces in this diagram:

  • (m1!,m1?,m2!,m2?)
  • (m2!,m1!,m1?,m2?)

But I have found a third: (m1!,m2!,m1?,m2?). Am I totally wrong?

Does somebody know what the answer is of my question? Or know where to find some absolutely clear information online about traces?

like image 443
Sabine Meijran Avatar asked Dec 16 '25 11:12

Sabine Meijran


1 Answers

TL;DR

You are correct.

Full answer

I will use e1 < e2 as e1 happening before e2.

In the given example following conditions have to be met:

  1. m1! < m1? (the message is always sent earlier than received)

  2. m2! < m2? (same as above)

  3. m1? < m2? (both events are on the same vertical line. With no modifiers (expansion regions) it means the one above has to happen earlier than the one below.

  4. m1! < m2? (as it is transitive property and we have m1! < m1? < m2?)

However, there is no information regarding the following relations:

  • m1! to m2!

  • m1? to m2!

So, we can put m2! in 3 possibile positions to meet the conditions 1-4 above (I'm marking positions with V):

V, m1!, V, m1?, V, m2?

Clearly m2! in V positions 1 and 3 above have been added to the book, but position 2 has been ignored.

Now, I don't know if the book provides examples of the possible traces or all possible traces based on the diagram. If the former, then the book is still correct (even if the list is incomplete). If the latter, the book is wrong, unless there are some additional conditions, that you didn't provide.

like image 80
Ister Avatar answered Dec 18 '25 23:12

Ister