UML Collaboration Diagrams
7. 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 creation a collaboration diagram and the collaboration diagram represents both of 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