Section 8.3. Communication Diagrams Versus Sequence Diagrams


8.3. Communication Diagrams Versus Sequence Diagrams

Communication and sequence diagrams present such similar information that a comparison is almost inevitable. Setting personal preferences aside, what are the best reasons for picking a sequence diagram, a communication diagram, or even a combination of both to model a particular interaction?

8.3.1. How the Fight Shapes Up

Figure 8-15 shows the two different representations of the same Create a new Regular Blog Account interaction.

Figure 8-15. The Create a new Regular Blog Account interaction can be modeled using a sequence diagram and a communication diagram


8.3.2. The Main Event

Beyond any arguments about personal preference, and using the interaction shown in Figure 8-15 as an example, Table 8-1 compares sequence diagrams and communication diagrams to help you decide which diagram is most useful for your modeling purposes.

Table 8-1. Comparing sequence and communication diagrams

Feature

Sequence diagrams

Communication diagrams

The result

Shows participants effectively

Participants are mostly arranged along the top of page, unless the drop-box participant creation notation is used. It is easy to gather the participants involved in a particular interaction.

Participants as well as links are the focus, so they are shown clearly as rectangles.

Communication diagramsbarely win. Although both types of diagram can show participants as effectively as each other, it can be argued that communication diagrams have the edge since participants are one of their main 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.

Communication diagrams win because they explicitly and clearly show the links between participants.

Showing message signatures

Message signatures can be fully described.

Message signatures can be fully described.

Draw! Both types of diagram can show messages as effectively as each other.

Supports parallel messages

With the introduction of sequence fragments, sequence diagrams are much better.

Shown using the number-letter notation on message sequences.

Draw! Both types of diagram show parallel messages equally well.

Supports asynchronous messages (fire and forget)

Achieved using the asynchronous arrow.

Communication diagrams have no concept of the asynchronous message since its focus is not on message ordering.

Sequence diagrams are a clear winner here because they explicitly support asynchronous messages.

Easy to read message ordering

This is a sequence diagram's forté. Sequence diagrams clearly show message ordering using the vertical placement of messages down the diagram's page.

Shown using the number-point-nested 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 fairly simple. However, maintaining sequence diagrams can be a nightmare unless a helpful UML tool is being used.

Communication diagrams are simple enough to create; however, maintenance, especially if message numbering needs to be changed, still ideally needs the support of a helpful UML tool.

This is a difficult one to judge and is largely based on personal preference. However, communication diagrams do have the edge on the ease-of-maintenance stakes.


OK, so the fight was a little biased and tongue-in-cheek in that the features assessed were already clear discriminators between communication and sequence diagrams. Although the results shown in Table 8-1 are not really surprising, it's worth stating once again that you should:

  • Use sequence diagrams if you are mainly interested in the flow of messages throughout a particular interaction.

  • Use communication diagrams if you are focusing on the links between the different participants involved in the interaction.

Perhaps the most important message to take away from this comparison is that although both types of diagram convey similar information, communication diagrams and sequence diagrams offer different benefits; therefore, the best approach, time willing, is to use both.




Learning UML 2.0
Learning UML 2.0
ISBN: 0596009828
EAN: 2147483647
Year: 2007
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net