Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
scroll top