nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Is it ok to omit arguments for method invocation in sequence diagrams? #253

Closed weekiat-douze closed 1 year ago

weekiat-douze commented 1 year ago
sequence

The example here is also not in the method() format. Is there any restrictions when drawing invocations in sequence diagram?

damithc commented 1 year ago

@weekiat-douze

This is a user typing a command, not a method call.

Also note:

  1. Sequence diagrams model interaction between entities for a specific scenario, not necessarily execution of a code segment
  2. When appropriate, you can use pseudo code in sequence diagrams
weekiat-douze commented 1 year ago

@damithc I see. Then would it be wrong if arguments are excluded in the pseudo code? For example, Week 8 Tutorial, addPerson() instead of addPerson(p) or Person() instead of Person("Adam", "friend")

PersonList personList = new PersonList();
while (hasRoom) {
    Person p = new Person("Adam", "friend");
    personList.addPerson(p);
}
damithc commented 1 year ago

I see. Then would it be wrong if arguments are excluded in the pseudo code? For example, Week 8 Tutorial, addPerson() instead of addPerson(p) or Person() instead of Person("Adam", "friend")

PersonList personList = new PersonList();
while (hasRoom) {
    Person p = new Person("Adam", "friend");
    personList.addPerson(p);
}

@weekiat-douze Depends on the context. It could be misleading as foo(x) and foo() are technically two different methods. Perhaps something like foo(...) might be better to clearly show that parameters have been omitted.

weekiat-douze commented 1 year ago

I see, understood. Thank you!