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.

2 Answers2

11

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

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.