You can show an object's change of state in a collaboration diagram, also you can show conditions the same way you represent them in sequence diagram.
In
the object rectangle, indicate the state of the object. To the diagram, add another
rectangle that stands for the object and indicate the changed state. Connect the two with
the dashed line and label the line with a <<become>> stereotype.
You put the condition inside a pair of square brackets, and the conditionprecedes the
message-label. The important thing is to coordinate the conditions with the numbering.
To get closer to this concepts please refer to the Collaboration Diagram - Example.
Also you can present object creation.
In
object's creation process you add a <<create>> stereotype to the message that
creates the object.
In the collaboration diagram, you can represent multiple objects and returned results.
The
representation of multiple objects is a stack of rectangles extending
"backward". You add a bracketed condition preceded by an asterisk to indicate
that the message goes to all objects.
Returned results are written as expression that has a name of the returned value on the
left, followed by :=, followed by the name of the operation, and
a list of possible attributes that operation can accept, to produce the result.The right
side of the expression is called a message-signature.
A proffesor asks a group of students to hand in an assignment. | ||
A message can be a request for an object to perform a calculation and return a value. |
In some interactions, a specific object controls the flow. This active object can send messages to passive objects and interact with other active objects. Also you might run into an object sending a message only after several other (possibly nonconsecutive) messages have been sent. That is, the object must sinchronize its message with a set of other messages.
The
collaboration diagram represents an active object the same way as other, except that its
border is thick and bold.
Sinchronizing messages, are precede with a list of the messages that have to be completed
prior to that message take place. A comma separates one list-item from another, and the
list ends with a slash.
Now when you have all this concepts, you're ready to go to the next lesson the Collaboration Diagram - Example.