Sequence Diagrams: Questions & Answers
How to model exception handling in sequence diagram?
UML provides neither notation to model exception handling in sequence diagrams
nor any reasoning why it is absent.
Some clumsy approaches to model try-catch blocks are by utilizing
combined fragments
- alt (alternatives)
and breaks,
while adding stereotypes for
reply messages
representing thrown exceptions.
There are several proposed notations for exception handling.
What is the difference between sequence diagram and communication (aka collaboration) diagram?
Can a sequence diagram be replaced by communication diagram?
It is generally assumed that sequence diagrams and communication diagrams (formerly known as collaboration diagrams) are equivalent and could be converted into each other.
UML 2.3 specification states that communication diagrams correspond to simple sequence diagrams that use none of the structuring mechanisms such as interaction uses and combined fragments. It is also assumed that for communication diagrams message overtaking (when the order of the messages received is different from the order of those being sent) will not take place or is irrelevant. It means that some complex sequence diagrams can not be represented by equivalent communication diagrams.
Do we show private or protected methods (messages) on sequence diagrams?
When sequence diagrams are used to show implementation, it usually doesn't matter whether methods
are public or private. If we want to show higher level interactions,
e.g. between components,
we might decide to show only public methods.
In either case, sequence diagrams have no notion
for visibility,
so there is no way to determine or specify visibility of a message on a sequence diagram.