2

I'm drawing a SEQUENCE DIAGRAM o a Public Phone (PP) system. What I am trying to do is : - A message for : The caller enters money and sends a call request with the callee phone number - A message for : PP Calculates the duration time of the call - A message for : PP printing call duration limit to the CALLER - A message for : The caller and the callee communicates during the call time calculated --> this message is sort of a duration message - A message for : PP detecting end of call time - A message for : For ending comunication

Below is a picture of what I'm trying to do:

enter image description here

How SHOULD I properly reprensent the Messages (especially Message 4 and the others after it ) WITHOUT a LOOP fragment here ? So that the duration is still obvious with the oblique line ...and that Message 10 is the one closing the duration of Message 4

Edited Diagram enter image description here

LAST altered diagram <--- OK !!!

I think that one sums up what you've both said

enter image description here

Kurt Miller
  • 567
  • 1
  • 8
  • 23

2 Answers2

3

The message 4 must not be drawn angled since this signals a duration of the message itself.

Again, you can make use of fragments:

enter image description here

The alt has a default and a timeout. You might augment this with an activity diagram that has a critical region which allows to show such timing constraints in a better way.

enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Is there a way to not use the neither OPT fragment nor any other fragment here ? If OPT is the only way you see this can I use [Defaul], [time exceeded], and [several other conditions] ? – Kurt Miller Apr 03 '16 at 17:13
  • Hey Kurt, Following your advices, I have edited the picture of my diagramm. Could you take a look at it ? – Kurt Miller Apr 03 '16 at 18:29
  • @JimL. You are probably right. But I don't put everything from Superstructures on the gold balance. Probably using `alt` and making it a bit narrower so only the returns are affected is better. I'll change that. – qwerty_so Apr 03 '16 at 20:37
  • @KurtMiller Your edited diagram looks better. Anyhow, take ADs in consideration alternatively. – qwerty_so Apr 03 '16 at 20:45
  • After taking into consideration what you both said, I've added one last diagram. I think it solves my issue. Could you take a look at it ? – Kurt Miller Apr 03 '16 at 22:23
  • I think that the `par` needs two partitions at least that are supposed to run in parallel. So one partition Send Caller's and one Send Callee's Voice. – qwerty_so Apr 04 '16 at 08:54
  • Yeah you are right. I have edited the diagramm and added 3 partitions as ther are 3 independent messages. – Kurt Miller Apr 04 '16 at 09:14
  • flawless answer! – Gaurav Sep 26 '22 at 12:23
1

You cannot show the participants talking without a loop. It does not take the duration XX:XX to send message 4. That seems to abuse UML.

You would be better off using asynchronous messages (the ones with open arrowheads). One to start the call, many back and forth messages between the caller and callee through the phone, and one to end the call. The back and forth messages through the phone can be shown as optional, parallel, and looping.

It seems what you should really be using is a state machine diagram. That would allow you to express all the allowed traces of this protocol, including what happens when a time limit is reached. A sequence diagram usually illustrates a subset of all the allowed traces. If you try to show them all, the diagram can become hard to read and nearly impossible to maintain.

Jim L.
  • 6,177
  • 3
  • 21
  • 47
  • I'm a beginner in UML so no idea of how to use machine state or timing diagram. Anywaythe 1st paragraph of your reply seem to suggest somthing like the answer right below yours. I wish I could do something without using fragments. – Kurt Miller Apr 03 '16 at 17:18
  • Here's a recent example I did of a state machine: http://stackoverflow.com/a/36368880/2596664 – Jim L. Apr 03 '16 at 17:21
  • If you must use a sequence diagram, at least change everything to asynchronous messages. – Jim L. Apr 03 '16 at 17:23
  • OK. I have edited the picture of my diagramm. Could you take a look at it ? – Kurt Miller Apr 03 '16 at 18:30
  • Looking better. I would make *all* the message asynchronous, though. You're not modeling a half-duplex walkie-talkie are you? Also, the optional part for when the time limit is reached is not *instead* of a conversation, is it? – Jim L. Apr 03 '16 at 18:36
  • Yes It is instead of a conversation. From what I understood about OPT fragment defition, first the [default] will execute. Then when [time limit reached] is true, it's block (Ends Call message) will be executed. (almost like a sequence). An ALT fragment would mean one or the other block. Are suggesting ALT is more appropriate ? – Kurt Miller Apr 03 '16 at 19:01
  • Your use of an optional interaction (`opt`) violates he UML spec. I'm surprised your tool allows it. There can only be only one optional part to it. Consider making an optional interaction for timeout handling within the loop. – Jim L. Apr 03 '16 at 20:03
  • Have I answered your question, "How could I properly represent the Messages [ . . . ] WITHOUT a LOOP fragment?" Basically, you can't, without omitting the participants talking. – Jim L. Apr 03 '16 at 20:08
  • After taking into consideration what you both said, I've added one last diagram. I think it solves my issue. Could you take a look at it ? AND YES you did answer my question. Actually I edited my OP....I meant How SHOULD I .... instead of How COULD I – Kurt Miller Apr 03 '16 at 22:24
  • This is close. I'm not sure you understand how synchronous and asynchronous messages work. The dashed lines are not valid. Just send the caller's voice and the callee's voice in one direction. As I originally said, "optional, parallel, and looping." You still haven't done that. "Phone hung up" should be an async message, both in the normal case and in the timeout case, as should "Ask to hang up". Also, move "ends the call" to happen as a result of "phone hung up" in both cases. – Jim L. Apr 03 '16 at 22:36
  • Ok. I did as you said ... with "optional, parallel, and looping" plus I fixed the async messages. I added a condition on the Loop also. Am I closer to what you said I should do ? – Kurt Miller Apr 03 '16 at 23:17
  • Let's just say you've come a *long* way today. This has gone *way* beyond the usual StackOverflow format. If you have more questions, please use the `Ask Question` button at the top of the page. – Jim L. Apr 04 '16 at 00:00
  • So it's OK now right ? Thank you for your help. (by the way I'm using Visual Paradigm for my diagrams) – Kurt Miller Apr 04 '16 at 00:08
  • Of course for the voting up and accepted as answer. Really helped me today (Thomas did to on another question). Mucho gracias senior – Kurt Miller Apr 04 '16 at 00:21