64
Sequence Diagrams And Collaboration Diagrams HungNM

Sequence Diagrams And Collaboration Diagrams HungNM

Embed Size (px)

Citation preview

Page 1: Sequence Diagrams And Collaboration Diagrams HungNM

Sequence DiagramsAnd Collaboration Diagrams

HungNM

Page 2: Sequence Diagrams And Collaboration Diagrams HungNM

Sequence Diagram Toolbar

Page 3: Sequence Diagrams And Collaboration Diagrams HungNM

The Collaboration Diagram Toolbar

Page 4: Sequence Diagrams And Collaboration Diagrams HungNM

Working with Actors on an Interaction Diagram

• To create an actor object on an Interaction diagram:1. Open the Interaction diagram.2. Select the actor in the browser.3 Drag the actor from the browser to the open

diagram.

Page 5: Sequence Diagrams And Collaboration Diagrams HungNM

Remove actor

• To remove an actor object from an Interaction diagram:– 1. Select the actor on the Interaction diagram.– 2. Select Edit / Delete from Model, or press Ctrl+D.

Page 6: Sequence Diagrams And Collaboration Diagrams HungNM

Working with Objects

• To add an object to a Sequence diagram:– 1. Select the Object toolbar button.– 2. Click in the location on the diagram where you want

the object to reside. In a Sequence diagram, objects are arranged in a row near the top.

– 3. Type the name of the new object.

Page 7: Sequence Diagrams And Collaboration Diagrams HungNM

Working with Objects

• Add an object to a Collaboration diagram:– 1. Select the Object toolbar button.– 2. Click in the location on the diagram where you want

the object to reside. In a Collaboration diagram, objects can be located anywhere.

– 3. Type the name of the new object.

Page 8: Sequence Diagrams And Collaboration Diagrams HungNM

Deleting Objects from an Interaction Diagram

• Remove an object– Select the object in the Sequence or Collaboration

diagram.– Select Edit / Delete from Model, or press Ctrl+D.

Page 9: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Object Specifications

• you can set the object's name, its class, its persistence, and whether there are multiple instances of the object.

• To open the object specifications:– 1. Right−click the object in the Sequence or

Collaboration diagram.– 2. Select Open Specification from the shortcut menu.

OR– 1. Select the object in the Sequence or Collaboration

diagram.– 2. Select Browse / Specification, or press Ctrl+B.

Page 10: Sequence Diagrams And Collaboration Diagrams HungNM

Naming an Object

• Each object on a Sequence or Collaboration diagram should be given a unique name.

• On an Interaction diagram, you may have two objects that are instances of the same class.

• To name an object:– 1. Right−click the object in the Sequence or

Collaboration diagram.– 2. Select Open Specification from the shortcut menu.– 3. In the Name field, enter the object's name. You

may also use this field to change the name of the object later on.

Page 11: Sequence Diagrams And Collaboration Diagrams HungNM

Add documentation to an object:

• 1. Right−click the object in the Sequence or Collaboration diagram.

• 2. Select Open Specification from the shortcut menu.• 3. In the Documentation field, you can enter

documentation for the object.

Page 12: Sequence Diagrams And Collaboration Diagrams HungNM

Mapping an Object to a Class

• On a Sequence or Collaboration diagram, each object may be mapped to a class.

• In the object specification window, you can use the Class field to set the object's class.

• Default, the class will be set to (Unspecified).• When selecting a class for the object, you can either use

an existing class from your model or create a new class for the object.

Page 13: Sequence Diagrams And Collaboration Diagrams HungNM

Mapping an Object to a Class

• 1. Right−click the object in the Interaction diagram.

• 2. Select Open Specification from the shortcut menu.

• 3. In the Class drop−down list box, type the class name

or select an option from the drop−down list box.

• 4. Once you have mapped the object to a class, the

class name will appear with the object name on the

diagram, preceded by a colon. You can toggle the

display of the class name by right−clicking the object and

selecting Show Class.

Page 14: Sequence Diagrams And Collaboration Diagrams HungNM

Mapping an Object to a Class

Or• Select the class in the Logical view of the browser.• Drag the class from the browser to the object in the

diagram.• Once you have mapped the object to a class, the class

name will appear with the object name on the diagram, preceded by a colon:

Page 15: Sequence Diagrams And Collaboration Diagrams HungNM

To remove an object's class mapping:

• 1. Right−click the object in the Sequence or Collaboration diagram.

• 2. Select Open Specification from the shortcut menu.• 3. In the Class drop−down list box, select (Unspecified).

Page 16: Sequence Diagrams And Collaboration Diagrams HungNM

To create a new class for the object:

• 1. Right−click the object in the Sequence or Collaboration diagram.

• 2. Select Open Specification from the shortcut menu.• 3. Select <New> in the Class drop−down list box. Rose

will take you to the specification window for the new class.

Page 17: Sequence Diagrams And Collaboration Diagrams HungNM

Setting view object and class property

Page 18: Sequence Diagrams And Collaboration Diagrams HungNM

Setting view object and class property

Page 19: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Object Persistence

Page 20: Sequence Diagrams And Collaboration Diagrams HungNM

Using Multiple Instances of an Object• Rose provides the option of using one icon to represent

multiple instances of the same class. • Say, for example, that you would like to represent a list

of employees on a Sequence or Collaboration diagram.

Page 21: Sequence Diagrams And Collaboration Diagrams HungNM

II. Working with Messages

• A message is a communication between objects in which one object (the client) asks another object (the supplier) to do something.

Page 22: Sequence Diagrams And Collaboration Diagrams HungNM

II.1 Adding Messages to a Sequence Diagram

• Select the Object Message button from the toolbar.• Drag the mouse from the lifeline of the object or actor

sending the message to the object or actor receiving the message, as shown in

• Type in the text of the message.

Page 23: Sequence Diagrams And Collaboration Diagrams HungNM

Add a reflexive message

Page 24: Sequence Diagrams And Collaboration Diagrams HungNM

Deleting Messages from a Sequence Diagram

Page 25: Sequence Diagrams And Collaboration Diagrams HungNM

Message Numbering in a Sequence Diagram

• To turn message numbering on or off:– 1. Select Tools / Options.– 2. Select the Diagram tab.– Set the Sequence Numbering check box to on or off,

as shown in

Page 26: Sequence Diagrams And Collaboration Diagrams HungNM

Message Numbering in a Sequence Diagram

Page 27: Sequence Diagrams And Collaboration Diagrams HungNM

III Adding Messages to a Collaboration Diagram

• Before you can add messages to a Collaboration diagram.

• You have to establish a path of communication between two objects. This path is called a link, and is created using the Object Link toolbar button.

Page 28: Sequence Diagrams And Collaboration Diagrams HungNM

Add a message to a Collaboration diagram:

Page 29: Sequence Diagrams And Collaboration Diagrams HungNM

To add a reflexive message

• 1. Select the Link to Self toolbar button.• 2. Click the object sending and receiving the message.

Rose will draw a reflexive link on the object. It will appear above the object and look like a half−circle.

• 3.Select the Link Message toolbar button.• 4. Click the object's reflexive link. Rose will add the

message arrow, as shown in

• 5. With the new message still selected, enter the text of the message.

Page 30: Sequence Diagrams And Collaboration Diagrams HungNM

Message Numbering in a Collaboration Diagram

Page 31: Sequence Diagrams And Collaboration Diagrams HungNM

Adding Data Flows to a Collaboration Diagram

• Collaboration diagrams show data flows; Sequence diagrams do not.

• Data flows are used to show the information that is returned when one object sends a message to another.

• You don't add data flows to every message on a Collaboration diagram.

• When you eventually map each message to an operation of a class, the information in the data flows will be added to the operation's details.

Page 32: Sequence Diagrams And Collaboration Diagrams HungNM

Adding Data Flows to a Collaboration Diagram

• 1. Select the Data Token or Reverse Data Token toolbar button.

• 2. Click on the message that will be returning data. Rose will automatically add the data flow arrow to the diagram, as shown in

• 3. With the new data flow still selected, type in the data that will be returned.

Page 33: Sequence Diagrams And Collaboration Diagrams HungNM

IV Setting Property Message : Setting Message Specifications• Double−click the message on the diagram. The message

specification window will

Page 34: Sequence Diagrams And Collaboration Diagrams HungNM

Naming a Message

• 1. Double−click the message on the Sequence or Collaboration diagram.

• 2. If you have mapped the receiving object to a class, the operations of that class will appear in the Name drop−down list box. Select an entry from the list or type in the name of the message.

Page 35: Sequence Diagrams And Collaboration Diagrams HungNM

Mapping a Message to an Operation

• Each message on your Sequence and Collaboration diagrams should be mapped to an operation of a class.

Page 36: Sequence Diagrams And Collaboration Diagrams HungNM

To map a message to an existing operation:

Page 37: Sequence Diagrams And Collaboration Diagrams HungNM

To remove a message's operation mapping:

• 1. Double−click the message in the Sequence or Collaboration diagram.

• 2. In the Name field, delete the operation name and enter the new message name.

Page 38: Sequence Diagrams And Collaboration Diagrams HungNM

Create a new operation for the message:

• 1. Be sure the receiving object (the supplier) has been mapped to a

class.

• 2. Right−click the message in the Sequence or Collaboration

diagram.

• 3. Select <new operation>.

• 4. Enter the new operation's name and details.

• 5. Click OK to close the operation specification window and add the

new operation.

• 6. Right−click the message.

• 7. Select the new operation from the list that appears.

Page 39: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

Page 40: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Simple This is the default value for messages. This option specifies that the message runs in a single thread

• of control.

Page 41: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Synchronous Use this option when the client sends the message and waits until the supplier has acted upon

• the message.

Page 42: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Balking With this option, the client sends the message to the supplier. If the supplier is not immediately ready to accept the message, the client abandons the message.

Page 43: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Timeout Using this option, the client sends the message to the supplier and waits a specified amount of time. If the supplier isn't ready to receive the message in that time, the client abandons the message.

Page 44: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Asynchronous With this option, the client sends the message to the supplier. The client then continues processing, without waiting to see if the message was received or not.

Page 45: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Procedure Call With this option, the client sends the message to the supplier. The client then must wait until the entire nested sequence of messages is processed before continuing. On the Sequence diagram, procedure call messages look like this:

Page 46: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Synchronization Options

• Return This option indicates the return from a procedure call. On the Sequence diagram, return messages look like this:

Page 47: Sequence Diagrams And Collaboration Diagrams HungNM

To set the message synchronization:

Page 48: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Frequency

• Message frequency lets you mark a message to be sent at regular intervals.

• Say, for example, you have a message that should run once every 30 seconds.

Page 49: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Frequency

• Periodic This option suggests that the message is sent on a regular, periodic basis.

• Aperiodic This option suggests that the message is not sent on a regular basis. It may be sent only once or at irregular points in time.

Page 50: Sequence Diagrams And Collaboration Diagrams HungNM

Setting Message Frequency

Page 51: Sequence Diagrams And Collaboration Diagrams HungNM

Create Interaction Diagrams

Page 52: Sequence Diagrams And Collaboration Diagrams HungNM

Setup

Page 53: Sequence Diagrams And Collaboration Diagrams HungNM
Page 54: Sequence Diagrams And Collaboration Diagrams HungNM
Page 55: Sequence Diagrams And Collaboration Diagrams HungNM
Page 56: Sequence Diagrams And Collaboration Diagrams HungNM
Page 57: Sequence Diagrams And Collaboration Diagrams HungNM
Page 58: Sequence Diagrams And Collaboration Diagrams HungNM

Collaboration diagram

Page 59: Sequence Diagrams And Collaboration Diagrams HungNM
Page 60: Sequence Diagrams And Collaboration Diagrams HungNM
Page 61: Sequence Diagrams And Collaboration Diagrams HungNM
Page 62: Sequence Diagrams And Collaboration Diagrams HungNM

Add Messages to the Diagram

Page 63: Sequence Diagrams And Collaboration Diagrams HungNM
Page 64: Sequence Diagrams And Collaboration Diagrams HungNM

• 7. Repeat steps 4 through 6 to add additional messages to the diagram

– Add white crew socks to cart (between Cart Interface and Cart Mgr)

– Get white crew socks (between Cart Mgr and Product Mgr)

– Find product (white crew socks) (between Product Mgr and Product Items)

– Get product (between Product Items and White Crew Socks)

– Add white crew socks to cart (between Cart Mgr and Cart Items)