A collaboration diagram— a.k.a as communication diagram in UML version 2.0— conveys the same information as a sequence diagram. Where time ordering is implicit in the linear layout of a sequence diagram, we explicitly indicate the time ordering by numbering the messages in geometrically organized collaboration diagrams.
Key symbols in collaboration diagrams are the rectangle, called a classifier role, and a line indicating the message, again called a connector. The classifier role represents the objects. Connectors represent connected objects, and a named arrow indicates the message as well as the sender and receiver.
As you can see, the collaboration has the same elements but fewer details. The compact nature and fewer elements make collaborations convenient when doodling designs.
To read the diagram, start with message 1 and follow the messages by number. Collaborations are not meant to use interaction frames and, as a result, don't convey as much information as the sequence diagram.
TIP: Consider using collaboration diagrams when working on a whiteboard or napkins or wherever you doodle your inspired designs. The compact nature and fewer adornments of collaboration diagrams make them more manageable when designing manually.
Comparing Sequence and Collaboration diagrams
Feature | Sequence Diagram | Collaboration Diagram | Remarks |
Shows participants effectively | Participants are mostly arranged along the top of page. It is easy to gather the participant involved in a particular interaction | Participants as well as links are the focus, so they are shown clearly as rectangle | Collaboration diagram win. Although both type of diagram can show participants as effectively as each other, it can be argued that collaboration diagrams have edge since participants are one of their focuses. |
Showing the links between participants | Links are implied. If a message is passed from one participant to another, then it is implied that a link must exist between those participants. | Explicitly shows the links between participants. In fact, this is the primary purpose of these types of diagram. | Collaboration diagrams win because they explicitly and clearly show the links between participants. |
Showing message signature | Message signatures can be fully described. | Message signatures can be fully described. | Both are good |
Support parallel messages | With the introduction of sequence fragments, sequence diagrams are much better. | Shown using the number-letter notation on the message sequences. | Both are good |
Support asynchronous message | Achieved using the asynchronous arrow. | Collaboration diagrams have no concept of the asynchronous messages, since its focus is not on the message ordering | Sequence diagrams are the clear winner because they explicitly support asynchronous messages |
Easy to read message ordering | Sequence diagram clearly show message ordering | Shown using the number notation | Sequence diagrams are a clear winner here since they really show off message ordering clearly and effectively. |
Easy to create and maintain the diagram | Creating a sequence diagram is simple. However maintaining sequence diagram can be a difficult unless a UML tool is being used | Collaboration diagrams are simple to create, however maintenance is difficult if we need to change the message numbering. | This is difficult to judge and large based on the personal choice. |
No comments:
Post a Comment