IN which kind of steps should be used the return line <- - - - - -
thanks
This is the diagram that I would like to fix.
I think the send email lines are wrong and Im nto sure if I shoudl have return lines after login
IN which kind of steps should be used the return line <- - - - - -
thanks
This is the diagram that I would like to fix.
I think the send email lines are wrong and Im nto sure if I shoudl have return lines after login
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.
result
<-------------
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
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:
class User{
public void login()
public void sendEmail()
}
class Patient{
public void getPatient()
}
class Doctor{
public void getDoctor()
}
class Appointment{
//This method returns something, but it's not clear what, so I assumed a boolean
public boolean checkAvailability()
}
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
It represents the return message of the operation.You can specify return values using this symbol.
Simple example:
club member
|
| getName()
'------------------------>.
|
|
result: "lee" |
<- - - - - - - - - - - - '
String memberName = member.getName();
//memberName now contains "lee"
The dashed arrow <- - - - is the return value from the method call.