0

uml activity diagram

Context: This is from a practice exam, and we aren't sure what the proper answer was

Question: What is a possible order of actions for this activity diagram?

Options:

  • A->B->D or A->B->C->D

  • A->B->C->D or A->B->C->D->E

  • A->B->C->D->E or C->A->B->E

  • A->B->C->D or C->A->B->E

  • Diagram is illegal

The first bar is called a FORK (where the flows after it happen simultaneously), the second bar is called a JOIN (where the flows join/sync up together) There is inconsistent behavior, C would need to happen at the same time as A->B->D or A->B->E and neither are options in the question.

A fellow student argues that it would be the 4th option because C just needs to happen at some point in the sequence (before the join).

What option do you think is right?

A P
  • 111
  • 4
  • This is more of a constructive question about understanding activity diagrams and forks, joins, (merges were out of the scope of the class)... I'm more curious about how to approach it properly than the actual answer. – A P Jul 12 '23 at 10:21

2 Answers2

2

In an exam setting with a multiple-choice question like that, where you don't immediately see what the right answer must be, you go into elimination mode: Strike off the answer options that are (clearly) wrong, and hopefully you are left with one option that is the least wrong or could actually be right.

In this case,

  • the diagram is valid, so that removes option 5.
  • a choice must be made between D and E, so any sequence that includes both must be wrong. That eliminates options 2 and 3.
  • option 1 has a proposed execution order that doesn't include C, which also is inconsistent with the diagram. So, strike option 1.
  • option 4 shows 2 valid orderings out of a much larger set of possible orderings. While that makes the option look incomplete, it is not wrong either. Given the set of options, this is the least wrong one and therefor most likely the one you are expected to give.
Bart van Ingen Schenau
  • 71,712
  • 20
  • 110
  • 179
  • What would make it invalid? – A P Jul 13 '23 at 04:44
  • 1
    @AP, omitting the JOIN node from the diagram would make it invalid and using a shape that doesn't have a defined meaning for an activity diagram as well. – Bart van Ingen Schenau Jul 13 '23 at 07:02
  • 1
    Each answer has two options that are OR-ed. Strictly speaking answer 1 cannot be eliminated because one of the options, A->B->C->D , is possible. The beauty of OR - you do not have to be totally right to be correct. ..... Either the instructor is throwing the class a crafty curve - multiple correct answers, OR, a class in flow/processing logic neglected to teach fundamental boolean algebra needed for understanding activity diagrams. – radarbob Jul 13 '23 at 22:28
  • 1
    @radarbob, by that reasoning, options 2 and 3 can't be eliminated either, because there is a valid ordering on one side of the OR. I don't think it is intended to interpret the use of "or" strictly according to boolean algebra. – Bart van Ingen Schenau Jul 14 '23 at 06:25
  • @BartvanIngenSchenau if they had a MERGE instead of join, would it have changed anything? – A P Jul 14 '23 at 13:06
  • I agree the OR is ambiguous to we readers but I am not reading a novel. The binary choice diamond operation works by a formal definition which is not AND. How, then, can we speak of the diagram behavior with a different definition of OR? Read the answers substituting "AND" then the meaning of OR is clear – radarbob Jul 14 '23 at 18:40
2

they are all wrong

"Forks are used to split an incoming transition into concurrent multiple transitions"

so the answer is:

parallel(A->B->(D or E), C)

Hopefully you have a quantum computer to make sure concurrency is strictly obeyed!

Ewan
  • 70,664
  • 5
  • 76
  • 161
  • so it's not illegal? – A P Jul 12 '23 at 12:32
  • 1
    no the diagram is fine, it just doesn't make sense to ask what order the individual tasks run in across forks – Ewan Jul 12 '23 at 12:40
  • 1
    The question is what is possible not what are all possible. With UML exams you need to be careful with those meanings. So in this case you have to eliminate all incorrect flows (i.e. answer options containing them) and if all flows in an answer option are possible within this flow (even if it doesn't cover all possibilities that can be achieved as a result of the diagram), the answer is correct. – Ister Jul 13 '23 at 11:36
  • arguable, and obviously if you get the question in an exam you have to choose an option. But that doesnt mean the question cant be badly phrased – Ewan Jul 14 '23 at 14:16