UML Collaboration Diagrams

A major task of the design phase is creating the interaction diagrams for the system operations. Read this section to learn more about collaboration diagrams. As you review the examples, consider general principles in assigning responsibilities. Ask yourself, how do you determine the relationship between objects? How can you extract the classes? How do you determine whether a mentioned feature can be considered a class attribute? How would you determine class methods?

Collaboration Diagrams

A collaboration diagram is a graphical representation which shows the linkage between a number of objects and the links between them. Collaboration diagrams show the messages that are passed from one object to another. Since both collaboration diagrams and object sequence diagrams can express similar constructs, we can opt to use one over the other. We shall mainly discuss and use collaboration diagrams. As an example, collaboration diagram for "makePayment(cashTendered)" operation for the POST system is shown in Figure 4.1


Figure 4.1: A Collaboration Diagram for makePayment(cashTendered) Operation

While in comparison with the object sequence diagram for "makePayment(cashTendered)" operation for the POST system we can have as shown in Figure 4.2.


Figure 4.2: A Object Sequence Diagram for makePayment(cashTendered) Operation

Both of the two diagrams represent the following pseudo program 

  • POST accepts a call of it method makePayment() (from an Interface Object); 
  • POST calls for the method makePayment() of :Sale; 
  • Sale calls the constructor of class Payment to create a new:Payment