Search code examples
umlsequence-diagramcollaboration-diagramcommunication-diagram

Does Collaboration/Communication Diagram have "OPT" fragment?


I have an OPT (Optional) fragment in my sequence diagram and I wanted to draw it on my collaboration diagram but unsure if there is such a thing as OPT fragmnet in collaboration? I googled and couldn't find any solutions.

One of my friends told me to use: [condition]: someFunction()

But I don't know if that is correct way


Solution

  • A communication diagram (that is the official name) is just one of the four possible views on an Interaction (the others being sequence diagram, timing diagram and interaction overview diagram). Each of the diagrams will show different aspects of the Interaction. So, an optional Fragment will be shown as a frame in a sequence diagram and as a guard on the message label of the first message contained in the fragment in a communication diagram. Since the connection between the messages is only deducible by the hierarchical message number, it is harder to see this connection. On the other hand, it is easier to see the network of connections between the participants of the interaction in a communication diagram.