4

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.

migrated from stackoverflow.com Jul 21 '15 at 23:36

This question came from our site for professional and enthusiast programmers.

7

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.

  • 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 – Charu Khurana Jul 22 '15 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. – James Anderson Jul 22 '15 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 '15 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. – qwerty_so Jul 22 '15 at 9:08
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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