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?

Creation of Collaboration Diagrams

When creating collaboration diagrams: 

  • Start with the responsibilities which are identified from the use cases, conceptual model, and system operations' contracts. 
  • Assign these responsibilities to objects, then: 
  • Decide what the objects need to do to fulfill these responsibilities in order to identify further responsibilities which are again assigned to objects. 
  • Repeat these steps until the identified responsibilities are fulfilled and a collaboration diagram is completed.

Responsibilities are assigned to classes of objects during object oriented design stage. Note that a responsibility is not the same thing as a method, but methods are implemented to fulfill responsibilities. Responsibilities of an object are implemented by using methods of the object which either act alone or collaborate with other methods and objects. For example, with reference to POST system:

  • The Sale class might define a method that is performing printing of a Sale instance; say a method named print., 
  • To fulfill that responsibility, the Sale instance may have to collaborate with other objects, such as sending a message to SalesLineItem objects asking them to print themselves.

Within UML, responsibilities are assigned to objects when creating a collaboration diagra.  The collaboration diagram represents both the assignment of responsibilities to objects and the collaboration between objects for their fulfillment. Example, as presented in Figure 4.9: 

Sale objects have been given a responsibility to print themselves, which is invoked with a print message. 

The fulfillment of this responsibility requires collaboration with SalesLineItem objects asking them to print.


Figure 4.9: Performing Print Operation on Each Object of a Multiobject