0

I'd like to highlight that this questions is about a System Sequence Diagram (SSD) and not a simple Sequence Diagram and of course any help would be appreciated!

I'm reading Graig Larman's book Applying UML and Patterns and I was wondering if it's possible to represent an if statement in a SSD to exit the system. For example, let's say we have a search bar in a blog site, when the user clicks on search and there is no result, I want the system to return an error message "No results matching your criteria" and then to exit the system. How can I represent this in an System Sequence Diagram?

  • Here is an excerpt from Fowler's UML book showing two notations for conditionals in sequence diagrams: informit.com/articles/article.aspx?p=169507&seqNum=2 – Doc Brown Feb 4 at 12:12
  • I tend to do a separate diagram for each outcome, since if/then conditionals get messy. Also, one goal of SSDs is to determine system operations. The null result is just a result (output) and won't make for any new system operations. – Fuhrmanator Feb 4 at 21:25
2

Generally speaking, a sequence diagram does not handle conditionals because the different outcomes of the conditional are two different sequences, and can be modeled as such. In your case, you have one sequence where the search returns the results, and one sequence where the search does not return any results, and if you consider both sequences to be of identical value, you make a sequence diagram for each.

This isn't really what a sequence diagram is for, though, it's for visualizing how entities in your system interact, especially when there is a chain of A interacting with B which interacts with C and so on in order to produce a result.

In your case, I would recommend instead generalizing the sequence to a simple request and response, whether the response is an error or not makes no difference in terms of the interaction between search bar and back-end. That part can be modeled instead using an activity diagram, which are made specifically for modelling control flow.

0

If I'm understanding you correctly, the standard way I've seen this depicted is with a square box rotated 45 degrees (also referred to as a diamond, despite how wrong such a reference is). One line goes to one of the points to bring the flow into the "diamond", and two lines, labeled true or yes and false or no respectively, lead out. This can also be expanded to describe three state cases, but I've not seen any such diagrams have a solution for four or more state cases.

protected by gnat Mar 12 at 12:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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