5

I am drawing sequence diagram for large integration project where one system will initiate the REST call to another system and there is a proxy in middle which will pass through the request like

A->b->C

where b is a pass through system. I have shown 200 returned from C->b->A. I am wondering how do I depict when C returns 500 or there is an IOException and A needs to retry n no of times before it gives up.

1

2 Answers 2

9

One way is to use Fragments like this:

enter image description here

But honestly: code is much clearer for such purposes. Avoid using a graphical representation where a few lines of (pseudo) code can clarify what a 1000 pictures obfuscate. Once (in the 80s) I also though that programming graphically would be an advantage. But now I'm old an wise and know that this was wishful thinking. It's simply stupid ;-)

Regarding the IOException this heavily depends on runtime behavior. Usually this is a message sent from c which is not a return message but will produce a call stack in a. This can be placed in an alt Fragment.

4
  • Couple of questions here: 1. Is an alt fragment not for conditional things like if x>5 then this flow otherwise alternate flow. 2. I agree 500 is not a return message but could you show how to depict this in diagram Jul 22, 2015 at 1:19
  • Exceptions tend to happen out of sequence. Leave them to use cases and keep them out of sequence diagrams where they add complexity but little information. Jul 22, 2015 at 7:26
  • +1 it has always amused me that about the same time that software people were deciding graphical programming was the future, hardware people were deciding that graphical design didn't scale and they needed HDLs
    – jk.
    Jul 22, 2015 at 8:26
  • I'm with @JamesAnderson. As said exception handling is very runtime specific which is why I idid not sketch it above. Activity diagrams have Interruptible Regions to show exception handling. SDs are not really suited for that purpose. Using alt is a "stutteringly" way to express exceptions.
    – user188153
    Jul 22, 2015 at 9:08
4

I have seen colleges try to cover every single possible exception and error condition in every use case and sequence diagram. The result has always been late delivery, hours spent in review and in the end very little benefit to the project.

One way of thinking about it ala "Black Swan" by N. Taleb is that there are just too many possible disasters waiting to happen; the ant-virus software renders the machine unusable, the data centre could flood, admin forgot to pay the electricity bill, you company gets borked by a competitor etc. etc.

Another way to think about it is there are only thee exceptions.

  1. The service is unavailable.
  2. The service failed before your request could be processed.
  3. The service failed after your request was processed.

While cases 2 and 3 have very different outcomes its usually impossible to tell the difference without further manual investigation.

1
  • Yeah. People try to program gtaphically with SDs. In my young days I (and others) thought this would be the future of programming. It isn't. SDs should focus on single (complicated) aspects and try to highlight them. Any over-use will just lead to desaster... P.S. Oh, we discussed that already a couple of years ago ;-)
    – user188153
    Oct 18, 2019 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.