How to represent mutiple calls in Seq diagram

918 views Asked by At

I have a question, if I have a code with a class that has a main function that creates objects of all other classes in the system and then make calls to some methods from these objects. My question is if this main function call a method of one object twice (with different parameters) how can I represent that in a sequence diagram at is thresembling the flow of the main method?

2

There are 2 answers

0
Red Beard On BEST ANSWER

Please find below a sequence diagram describing the following seqeunce: - Creation of an instance b of type B - Creation of an instance a1 of type A - Creation of an instance a2 of type A - Call of the operation Foo defined on B with a1 as parameter - Call of the operation Foo defined on B with a2 as parameter

enter image description here

0
Rainer Berger On

In a sequence diagram, time is represented a going down vertically. For first function call, you would have an invocation from the object containing your main function to the object that you created, and you can annotate that invocation with the parameters used. For the second function call, you simply draw the second invocation below the first one, again you can annotate that with the parameters to be used.