how do you represent this.println in a sequence diagram?

Viewed 136
public class ReportPrinter {
    public static void printStudentReport(Student s) {
    CorsoDiLaurea cdl = s.getCorsoDiLaurea();
    Carriera c = s.getCarriera();
    String a = s.getInfoAnagrafiche();
    this.println (a + "\n" + cdl.detailString() + "\nCarriera:");
    for(EsameSostenuto e: c.getEsamiSostenuti() ) {
        this.println(e.nome + "-" + e.cfu + "-" + e.getVoto() );
    }
    this.println ("Media: " + c.get.Media() );
  }
  /*any code omitted */
}

I have more or less arrived at this solution (below) but how is this managed? the println method is part of System.Out so you need to create a lifeline?

enter image description here

1 Answers

Well, yes. And no. It always depends on your audience. SDs are not meant for graphical programming but to show (more or less) collaboration between objects. Preferably only complicated ones. So you are asking for a triviality. And probably nobody is interested how the println will be worked at in the system stomach. Except you want to implement the println itself. So there are three ways. Either you create a lifeline for the according system object and pass that as a message. Or you simply (!) add a note that the result will be printed. Finally you can just skip it. The println itsef would be (I guess) of lessest interest and you are more about where the data for it will be derived from.

In short: don't overdo SDs. KISS

N.B. The create messages in your diagram go slightly upward. That's not so good (I haven't checked whether that's actually wrong). But time goes down in a SD. So that would be a time travel back. Either the messages are straight or they are down (if you want to show some timeing constraint).

Related