The Collaboration Diagram

The collaboration diagram is the direct cousin of the sequence diagram. The two differ only in their perspectives. The collaboration diagram has an “on top looking down” view of the interaction. It focuses more on the actual objects and their roles in the interaction than on the linear flow of time expressed in the sequence diagram. Figure 7-11 shows a collaboration diagram for the happy path of Process Orders.

Figure 7-11. Collaboration diagram for the Process Orders happy path


Here's where sequence numbers become important. Whereas the sequence diagram works fine without them, the collaboration diagram is useless without them because the order of the messages is lost. The collaboration diagram offers a perspective of just how busy certain objects can be: sending messages, receiving messages, or both. An object's being busy may mean that its lifecycle is interesting, and thus the project might benefit from a state diagram of that object. State diagrams are discussed in the next section.

Some visual modeling tools will create a collaboration diagram directly from a sequence diagram. When using Rational Rose, you need only to have a sequence diagram open in a window and then click on the menu option Browse | Go To Collaboration Diagram. Rose also makes it easy to toggle back and forth between sequence and collaboration diagrams.

Collaboration diagrams make it a bit easier to model complex branching conditions and the concept of multiple concurrent threads of activity. A thread identifier, as well as merging and splitting of control, can be added to the sequence number.

I usually use a sequence diagram rather than a collaboration diagram, perhaps because I have used the sequence diagram much longer. Also, however, I think that it's clearer to the casual observer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.131.212