Edited by Roger, 17 April 2012 - 12:43 PM.
Image removed since it pointed to an unrelated photo
Sequence Diagram help
Started by ahmed, Jan 03 2011 03:32 AM
11 replies to this topic
#1
Posted 03 January 2011 - 03:32 AM
I have to make a sequence diagram for user registration . Can anyone tell me if the one i made is correct or not?and how can i make loop if the register response is failure?
|
|
|
#2
Posted 03 January 2011 - 04:39 AM
you can make two sequence diagrams, one for success and one for failure. To my knowledge i don't think there is a way to represent a loop in a sequence diagram, you just create a diagram for each scenario.
#3
Posted 03 January 2011 - 04:59 AM
Basically what you have done is correct. But I would suggest to use usual variable names for the return labels. For example, instead of Success/Failure maybe you could use RegistrationStatus. This way it's easier to synchronize with the actual code in implementation. Not mandatory, though :).
About looping, it's very easy to add. Just enclose the area containing the operations to be looped with a rectangle and in the top left corner of the rectangle add keyword Loop and the condition to exit the loop. For example in your case maybe something like (using your current notation): Loop Success=True. To avoid infinite loop, you have to add some TryCount variable and initialize it to proper value prior to enter looping.
Here a loop example diagram:
About looping, it's very easy to add. Just enclose the area containing the operations to be looped with a rectangle and in the top left corner of the rectangle add keyword Loop and the condition to exit the loop. For example in your case maybe something like (using your current notation): Loop Success=True. To avoid infinite loop, you have to add some TryCount variable and initialize it to proper value prior to enter looping.
Here a loop example diagram:
#4
Posted 03 January 2011 - 05:42 AM
thanks for the reply i will edit the diagram . and thanks for the loop example but i have another question that if i put the whole loop box around my diagram , if i get success how will i show that i am out of the loop ?
#5
Posted 03 January 2011 - 05:54 AM
Well, send a message to the object that use the loop result (or the object that started the loop in the first place). If the object is outside the diagram, just send a result to the boundary of the diagram (logically this outside object also started the sequence with a message coming from outside/boundary to the first object used in the diagram). Let me know if I am not clear enough, I'll see if I can get a sample diagram.
#6
Posted 03 January 2011 - 05:58 AM
too tricky didn't get it sorry :c-blink:
#7
Posted 03 January 2011 - 06:09 AM
:) Okay, see the following sample diagram?

What I meant by "send a result to the boundary of the diagram" is like the last return message labeled as balance in the diagram. See that the sequence also started from outside by notation of incoming message labeled as getBalance(accountNumber).

What I meant by "send a result to the boundary of the diagram" is like the last return message labeled as balance in the diagram. See that the sequence also started from outside by notation of incoming message labeled as getBalance(accountNumber).
#8
Posted 05 January 2011 - 06:37 AM
Considering this thread is already about sequence diagrams im kinda stuck on how to draw something in a sequence diagram.
I got the following
This is just an example btw but anyways.
Theres 3 classes here StartClass, ClassA and ClassB
Class has a function called doIt(). However this function executes functions in ClassB namely: functionA() and functionB()
Now my question is, how do i draw this one out in Sequence diagrams. Do i need to draw in the messages send to ClassB or do i need to omit these cause they are executed within the function doIt().
Hope it is clear, and thanks in advance.
I got the following

This is just an example btw but anyways.
Theres 3 classes here StartClass, ClassA and ClassB
Class has a function called doIt(). However this function executes functions in ClassB namely: functionA() and functionB()
Now my question is, how do i draw this one out in Sequence diagrams. Do i need to draw in the messages send to ClassB or do i need to omit these cause they are executed within the function doIt().
Hope it is clear, and thanks in advance.
#9
Posted 05 January 2011 - 08:40 AM
It's for you to decide. Do you want a very detailed diagram or not? If ClassB plays significant role or can make the process clearer to reader then you should show its messages. Event if it's not significant, there is no penalty to add more details (except more crowded diagram).
#10
Posted 05 January 2011 - 12:55 PM
Thanks for the reply but is the long arrow allowed (the self message call arrow) over the other function to show that the function doIt() sends messages to functionA() and functionB()?
#11
Posted 05 January 2011 - 06:10 PM
No. You can't send messages to something isn't there :)
#12
Posted 06 January 2011 - 03:08 AM
Ah ok thanks a bunch, thats all i needed to know :)


Sign In
Create Account


Back to top









