4. Collaboration Diagram Toolbar Text Selection Tool Note Anchor Note to Item Object Link to Self Data Flow Class Instance Reverse Link Message Reverse Data Flow Object Link Link Message
To create a collaboration diagram in the Browser Click right to select the “owning” package or use case in the Browser and make the pop up menu visible. Select the New:Collaboration Diagram menu command. While the diagram is still selected, enter the name of the diagram. To open a collaboration diagram Double click on the collaboration diagram in the Browser. Explain that a collaboration diagram may be created in either the use case view or the logical view. The diagram is “owned” by either a package or a use case. Our process and OOAD course have use case realizations in the logical view. For simplicity, this course just uses the use case view.
To customize the sequence diagram toolbar Click right on the toolbar to make the pop up menu visible. Select the Customize menu command Click to select the button that you want to add or remove. Click the Add or Remove button to add or remove the button from the toolbar. Click the Close button to close the Customize Toolbar window.
To add an actor to a collaboration diagram Click to select the actor in the Browser. Drag the actor onto the diagram. To create a named object Click to select the object icon on the toolbar. Click on the collaboration diagram to place the object. While the object is still selected, enter its name. To assign an object to a class Click to select the class in the Browser. Drag the class onto the object. To create an anonymous object (unnamed object assigned to a class) Click to select the object icon on the toolbar. Click on the collaboration diagram to place the object. Follow the steps to assign an object to a class.
To create a link Click to select the Object Link icon on the toolbar. Click on the client object (object sending the message). Drag the object link to the supplier object. A link provides a pathway for communication between objects. It allows the objects to “talk”.
To create a message Click to select the Link Message icon (or the Reverse Link Message icon) on the toolbar. Click on the line representing the link to place the message arrow. While the message arrow is still selected, enter its name. To set message numbering Select the Tools:Options menu command. Select the Diagram tab. Click the Collaboration Diagram Numbering check box to toggle the selection (numbering on, numbering off). Objects communicate through messages. A message is shown as an arrow attached to a link that points from the client (sender of the message) to the supplier (receiver of the message).
To create multiple objects of the same class Click-right on the object on a collaboration diagram to make the pop up menu visible. Select the Open Specification menu command. Click the Multiple Instances check box to toggle the selection. A message may be sent to multiple objects of the same class. This may be shown in a collaboration diagram by “ stacking” the object icon.
To create a reflexive message Click to select the Link to Self icon on the toolbar. Click on the object on the collaboration diagram that needs a reflexive message to place the link. Click to select the Object Message icon on the toolbar. Click on the line representing the link to self to place the message arrow. While the message is still selected, enter the name of the message. A reflexive message indicates that the object is collaborating with itself.
To create multiple messages on the same arrow Click right on the link to make the pop up menu visible. Select the Open Specification menu command. Select the Messages tab. Click right to make the pop up menu visible. Select the appropriate Insert to … menu command to insert a new message (the next number will be used). While the new message is still selected, enter its name. Click the OK button to close the Specification. Note: If a collaboration diagram is created from a sequence diagram, this is the format that is used. All messages attached to a given message arrow will have the same synchronization option. If different synchronization is needed, then each message must have its own arrow.
To switch between a collaboration diagram and a sequence diagram Press the F5 button.
To create a data flow Click to select the Data Flow icon (or the Reverse Data Flow icon) on the toolbar. Click on the message arrow that it modifies to place the data flow. While the data flow is still selected, enter its name. A data return value may be shown on a collaboration diagram. Stress that this is only shown for “significant” data returns.
To set message synchronization Click right on the message arrow to make the pop up menu visible. Select the Open Specification menu command (the object must be assigned to a class). Select the Detail tab. Select the desired synchronization. Click the OK button to close the Specification. Simple -- single thread of control Synchronous -- operation proceeds when the client sends a message to the supplier and the supplier accepts the message Balking -- Client sends a message only if the supplier is immediately ready to accept the message Timeout -- Client abandons a message if the supplier cannot handle the message within a specified amount of time Asynchronous -- client sends a message to the supplier for processing and continues to execute without waiting for a reply.
To create a sequence diagram from a collaboration diagram Open the collaboration diagram. Press the F5 button. Move the objects as needed. Note: Pressing the F5 button will allow you to go between a collaboration diagram and its corresponding sequence diagram.
Hints: This is the Close Registration - Main Flow collaboration diagram attached to the Close Registration use case. You need to create four new classes -- MainForm, CloseRegistrationForm, CloseRegistrationController and Schedule. You can do this via the Object Specification by selecting the Class Field = New value (see previous lesson, pages 6 and 7). Relocate the new classes to the following packages in the Logical View MainForm and RegistrationForm belong in the User Interface package CloseRegistrationController belongs to the Business Services package. Schedule belongs to the Business Objects package.
Hint: Create the sequence diagram from the collaboration diagram by pressing the F5 button. Move objects and messages as needed.