views:

51

answers:

3

IN which kind of steps should be used the return line <- - - - - -

thanks alt text

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

+2  A: 

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 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

chrisbunney
The objects in a sequence diagram should always correspond to an object in the class diagram, or can be included more?
Milena
They would normally correspond to a class in a class diagram, yes. I should also note that the Actor (Anonymous User) should be depicted as a stick man, but the program I used for this doesn't fully support UML2 yet
chrisbunney
ok thank you ;)
Milena
OK according to this I feel now like I have a big mess.What Im trying to model is the following:A user login in the system as a patient (role) to ask for an appointment.The patient should enter doctor and then date. System should verify the availability for that date, if theres avilability should create the new appointment and send an email to the user.If user login as a doctor(role) it goes different but now I dont want to include thatThe email im not sure if tis ok
Milena
I see what you're trying to achieve, but don't have the time right now to give my suggestions. Hopefully you're able to wait until Sunday when I'll be able to give a suitable response
chrisbunney
sure thanks. am I too far from this idea???
Milena
Well, perhaps not. However, I think that we're beginning to stray away from the original question. You should consider posting a new question asking the best way to approach/design the use case you describe (if you do ask it in a new question, if you link to in a comment I can look at it when I'm back)
chrisbunney
here: http://stackoverflow.com/questions/2935212/sequence-diagram-example
Milena
+2  A: 

It represents the return message of the operation.You can specify return values using this symbol.

daedlus
+2  A: 

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.

dalton