Open bingsen0806 opened 2 years ago
I think (1) is a better choice for the return from generate()
and (2) is not required.
Since it is possible for us to refactor the code such that we save the task and return it outside the if-else branch condition while keeping the same code behavior, I think the return can be moved outside the alt frame.
Both are fine. Personally, I would opt for the version that matches the code more closely i.e., 2.
I am having some problems when attempting to draw this sequence diagram in AY1819S1 past year, the question is shown below:
Below is my attempt, I am unsure if it is correct, but I have 2 questions regarding my attempt.
Should the bottom border for alternative paths moved up a bit (as shown by red line), such that the border for alternative path ends before the dotted line representing the return from
generate()
? I am tempted to move it up because the box for alternative path starts inside the activation bar of generate(), and it seems like the box should also end in the activation bar. However, if you look at the code, the return statement is inside the else branch, so it also makes sense for the activation bar and dotted line to appear before the closing of the alternate path. Therefore, I am confused as to which one is correct.Is the dotted line marked as (2) in the diagram necessary?