Closed richardcom closed 3 years ago
Can you provide the updated code that would make the diagram ambiguous?
Hi Prof Damith, thank you for your reply. I was wondering for the code below, maybe the above sequence diagram might cause ambiguity between class 1 and class 2, since we are unsure whether new Dog() is called by m.set(d) or is directly initiated in the m object instead(afterm.set(d) has already ended).
Man m = new Man();
m.set();
// class 1
class Man {
Dog d;
void set() {
}
this.d = new Dog();
}
// class 2
class Man {
Dog d;
void set() {
this.d = new Dog();
}
}
🤔 class 1 code is not correct. this.d = new Dog();
is not inside a method.
Oops, I am so sorry for this haha. Thank you Prof Damith @damithc ! I think maybe for most of the time omitting the activation bar will not cause much problem haha.
Hi!! In sequence diagram, it is mentioned that activation bars can be omitted if it results in no ambiguity. However, may I please clarify a little more on what are some of common conditions that might lead to ambiguity.
For example, in the following question, if the
new Dog()
is called bym
instead, then under this situation, shall we consider that the simplified diagram is ambiguous. Since then we are unsure whethernew Dog()
is called bym.set(d)
or is directly initiated in them
object instead(afterm.set(d)
has already ended).