In which kind of steps should be we use the return line in a sequence diagram?
<- - - - - -
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The return line represents the flow of control returning from a method/function call
In the case of methods/functions that return a result, it would indicate a value is being returned.
E.g.
Otherwise, for void methods/functions it would just be the arrow
For asynchronous calls, as the caller doesn’t yield control to the invoked method/function, I would only use a return line if it returned a result (e.g. non-void methods/functions)
Hope that helps
EDIT
Here is an example of a sequence diagram I created for a search use case
example of a sequence diagram I created for a search use case http://web10.twitpic.com/img/107669708-1d6f9df82534756bfe2a684d4480cc43.4c00f3b0-full.png
Note that the Anonymous user only makes asynchronous calls because, as a human being, they do not yield control to the application, hence no return arrows
Also note the return arrow of the search() call, which returns ‘results’
Finally, the creation arrows ( ——|> ) do not have return arrows as they implicitly return the instantiated object
EDIT 2
In response to your updated question:
I would not have return arrows for operations by the user, such as login(), as the results are not returned to the user in the same manner as an object, but normally outputted to some kind of UI. Another way of looking at it is that the user is outside the scope of the program, so it doesn’t make sense to return results directly.
From your diagram, my interpretation (in a kind of pseudocode) would be:
As you can see, all but one of these methods do not return anything. If that’s what you wanted then good, but I suspect that’s not the case.
I also suspect you did not intend for the sendEmail() method to be in the User class.
You should also consider what is happening when checkAvailability() returns, as the the flow of control seems to return to User and then inexplicably jump back to Appointment