Rational Rose 2000 Interaction Diagrams Introduction to Rational

  • Slides: 34
Download presentation
Rational Rose 2000 Interaction Diagrams Introduction to Rational Rose 2000 v 6. 5 Copyright

Rational Rose 2000 Interaction Diagrams Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 1

Module Objectives w Define interaction diagrams. w Describe when and how to create interaction

Module Objectives w Define interaction diagrams. w Describe when and how to create interaction diagrams. w Use Rational Rose to create interaction diagrams. w Auto generate interaction diagrams. w Run reports to check mapping. w Run a Rose. Script to check messages. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 2

Where Are We? Interaction diagrams are created and refined during the elaboration phase of

Where Are We? Interaction diagrams are created and refined during the elaboration phase of this workflow – for architecturally significant use cases. For remaining use cases, interaction diagrams are created during the Construction phase. (Guess what this means…) Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 3

Where Are We? Interaction Diagrams are created and refined during four analysis and design

Where Are We? Interaction Diagrams are created and refined during four analysis and design activities (above) (architectural, use-case analysis, use case design; subsystem design. ) Input artifacts vary depending on if you are in analysis or design. Remember, input artifacts are always being updated during previous activity. We will finish up Use Case Analysis next week…. ) Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 4

Where are we – continued. w Architectural and Use Case Analysis Use case realizations

Where are we – continued. w Architectural and Use Case Analysis Use case realizations identified during the requirements workflow may first be created during architectural analysis or use case analysis The focus shifts from the big picture to a specific use case. Preliminary use case realizations are identified and modeled as interaction diagrams. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 5

Where are we – Architectural and Use Case Analysis w Input artifacts to Architectural

Where are we – Architectural and Use Case Analysis w Input artifacts to Architectural and Use Case Analysis: (some of these…) § Use case model § Software architecture document § Supplementary specifications § Design model (more with Use Case Realizations with Interaction Diagrams and Collaboration Diagrams) § Glossary § Design guidelines (platforms, tools, implementing languages, constraints, etc. ) Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 6

Where Are We – continuing…. Introduction to Rational Rose 2000 v 6. 5 Copyright

Where Are We – continuing…. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 7

Where are we: Use Case Design w Interaction diagrams, initially defined in use case

Where are we: Use Case Design w Interaction diagrams, initially defined in use case analysis, are refined. w Analysis Classes are replaced with design subsystems and classes. w Input Artifacts: (Again, ‘some’ of these…) § Supplementary specifications; § Design Subsystems; § Use Case; § Interfaces; § Use Case Realizations; § Design Classes Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 8

Where are we – Subsystem Design w Realizations between the subsystem’s interfaces and contained

Where are we – Subsystem Design w Realizations between the subsystem’s interfaces and contained classes are defined. w Detailed design of the subsystem may result in changes to the Use Case realization. w Input artifacts § Use case realizations § Design subsystem with interface definitions § Design guidelines Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 9

Key Concepts w Interaction diagrams § A Use Case’s flow of events describes a

Key Concepts w Interaction diagrams § A Use Case’s flow of events describes a sequence of transactions performed by the system, whereas interaction diagrams visually capture a single instance of a use case’s flow of events (a specific path…) § Two variations: – collaboration and sequence. Both help to identify objects, classes, interactions, and responsibilities from a slightly different perspective. § Collaboration diagrams show objects associate with each other. RUP recommends creating these diagrams during use case analysis. They become too large and complex during design. § Sequence diagrams show time-based object interaction. RUP recommends creating these during use case design. § Both diagrams help validate the architecture and clarify the roles of objects in a flow, providing basic input for determining class responsibilities and interfaces. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 10

Reports and Scripts w Reports § Show unresolved objects - lists all objects not

Reports and Scripts w Reports § Show unresolved objects - lists all objects not attached to a class. § Show unresolved messages - lists all messages not attached to an operation. w Script § A Rose. Script that identifies several problems with messages, including messages without operations attached to them. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 11

Part of Deliverable #4: w Objectives of following Rose diagrams: § Create collaboration diagrams.

Part of Deliverable #4: w Objectives of following Rose diagrams: § Create collaboration diagrams. § Constructed sequence diagrams. § Auto generate diagrams. § Run Reports to check mapping. § Run Script to check mapping. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 12

Add Collaboration Diagram - Setting up the Structure In the browser, collaboration diagram added

Add Collaboration Diagram - Setting up the Structure In the browser, collaboration diagram added under its use case realization Expand the Design Model (in Logical View). Expand Use Case Realizations Package Expand the Use Case Realization – Register for Courses Right click on Register for Courses Click New, then click Collaboration Diagram. (Note the collaboration symbol) Type Register for Courses – Basic Flow ‘over’ New Diagram Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 13

Collaboration Diagrams (continued) In the browser, collaboration diagram added under its use case realization

Collaboration Diagrams (continued) In the browser, collaboration diagram added under its use case realization Double click Register for Courses – Basic Flow collaboration diagram symbol. Collaboration diagram window is now displayed. Use the format below to name both collaboration and sequence diagrams. <use case realization name> - <flow type> Flow types can be basic (main), alternate, and exceptional. (Remember: You cannot delete from the diagram itself. To delete an unwanted element, go to the Edit menu; then click Delete from Model. ) Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 14

Create a Collaboration Diagram Actor added to diagram Objects added to diagram Add Actors:

Create a Collaboration Diagram Actor added to diagram Objects added to diagram Add Actors: In the browser, expand the Use Case View again From the Use Case View, drag the Student actor onto the collaboration diagram Add objects: Name objects as you add them to avoid duplication. From the diagram toolbar, click the Object icon. Click the diagram to add the object. Click on the object, then type: : Register. For. Courses. Form Repeat steps above for : Registration. Controller Size objects if needed to fit text. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 15

Create a Collaboration diagram Object assigned to class Assign objects to classes 1. In

Create a Collaboration diagram Object assigned to class Assign objects to classes 1. In the browser, drag the Register. For. Courses. Form boundary class on to the Register. For. Courses. Form object in the diagram window. What happens? 2. Repeat step 1 for the remaining object. Actors Because actors are external to the system, it is not necessary to assign them to a class. Remember, we will be using these classes to create a class diagram, which represents only the system and not elements external to the system. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 16

Create a Collaboration diagram Object assigned to class Mapping We’ve moved directly to mapping

Create a Collaboration diagram Object assigned to class Mapping We’ve moved directly to mapping objects to classes. To do so, analysis classes and operations had to be discovered and modeled. We assume that activity has already been done. It’s important to understand that interaction diagrams can be modeled during analysis using objects and responsibilities. When the classes and operations are discovered, the designer will then refine the diagrams and map objects to classes and responsibilities to operations. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 17

Create a Collaboration Diagram Self link added to object Link added between objects Links

Create a Collaboration Diagram Self link added to object Link added between objects Links - pathways for communications between objects. Can have links back to self Add object links 1. From the diagram toolbar, click the Object Link icon. Drag your mouse from Student to the : Register. For. Course. Form class 2. Repeat step 1 to add an object link from : Register. For. Courses. Form to to Registration. Controller. Add a self link. From the diagram toolbar, click the Link To Self icon. Click : Register. For. Courses. Form. What happens? Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 18

Create a Collaboration Diagram (continued) Operation added to link Select collaboration numbering With numbering

Create a Collaboration Diagram (continued) Operation added to link Select collaboration numbering With numbering active, you must add the messages in order. 1. Make sure collaboration numbering is selected. On the Tools menu, click Options. Click Diagram. 2. Select the Collaboration numbering check box under Display, then click OK. (Do: Tools, Options, Diagrams… Also see on-like help; “numbering” gives more on hierarchically-numbering these puppies. ) Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 19

Create a Collaboration Diagram ( continued) Operation added to link Add operations to messages

Create a Collaboration Diagram ( continued) Operation added to link Add operations to messages A message link represents communication between two objects that triggers an event. In a collaboration diagram, it can represent multiple messages. 1. From the diagram toolbar, click the Link Message icon. Click the link between Student and : Registration. For. Course. Form. The message arrow is added above the link. 2. Right-click the message arrow; then click //register for courses( ) from list of operations 3. Repeat steps 1 and 2 to add a message to : Register. For. Courses. Form’s self-link. 4. Repeat steps 1 and 2 to add a message from : Register. For. Courses. Form to : Registration. Controller. 5. Move arrows and messages as needed to clean up the diagram. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 20

Create a Collaboration Diagram Multiple operations added to link Add multiple operations 1 Right-click

Create a Collaboration Diagram Multiple operations added to link Add multiple operations 1 Right-click the message arrow, then click //create schedule( ) from the list of operations. 2 Repeat steps 1 for the remaining messages. Remember, you must add them in order. . Note: What kind of class is Register. For. Courses. Form? Note the number of messages from the actor (external) to this class. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 21

Create Sequence Diagram Sequence diagram in browser Partially completed sequence diagram Complete a sequence

Create Sequence Diagram Sequence diagram in browser Partially completed sequence diagram Complete a sequence diagram 1. In the browser, expand the Logical View; Design Model; Use Case Realizations 2. Expand Use Case Realizations-Register for Courses, and Register for Courses 3. Double-click the Register for Courses - Basic Flow sequence diagram. Note the sequence diagram symbol. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 22

Create Sequence Diagram Object added to diagram Add objects 1. From the diagram toolbar,

Create Sequence Diagram Object added to diagram Add objects 1. From the diagram toolbar, click the Object icon. Click on the diagram to add object. 2. With the object selected, type : Registration. Controller. Size object to fit text. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 23

Create Sequence Diagram Object assigned to class Operation added to diagram Assign objects to

Create Sequence Diagram Object assigned to class Operation added to diagram Assign objects to classes In browser, drag the Registration. Controller control class on to the Register. Controller object Add operations to messages 1. From the diagram toolbar, click the Object Message icon. Drag your mouse from Register. For. Courses. Form to Registration. Controller. Message arrow added. 2. Right-click the message arrow, then click //is registration open? () from the list of operations. What happens to the sequence numbering? 3. Move arrows and messages as needed to clean up diagram. Unlike collaboration diagrams, sequence diagrams can have only one message between objects. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 24

Create Sequence Diagram Anchor added to note Note added to diagram Add notes. Notes

Create Sequence Diagram Anchor added to note Note added to diagram Add notes. Notes link one diagram to another diagram. A linked diagram is indicated by underlined text in the note. 1. From the diagram toolbar, click the Note icon. Click on the diagram. The note icon is added. 2. With the note selected, type an appropriate note In the browser, drag the Register for Courses - Basic Flow (Delete Schedule) sequence diagram on to the note. Notice that the note’s text is now underlined, indicating the note is now linked to the diagram. 3. Size and position the note Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 25

Create a Sequence Diagram Anchor added to note Note added to diagram Anchor notes

Create a Sequence Diagram Anchor added to note Note added to diagram Anchor notes 1. From the diagram toolbar, click the Anchor Note to Item icon. Drag your mouse from the note to the “One of these is executed: ”note 2. To also anchor the note to message 6, click the anchor. 3. Place your cursor in the middle of the anchor, then drag your mouse to the message arrow. 4. Double-click on a note. What happens? Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 26

Auto Generate Diagrams Sequence diagram generated from collaboration diagram Recommend you auto generate sequence

Auto Generate Diagrams Sequence diagram generated from collaboration diagram Recommend you auto generate sequence diagrams from collaboration diagrams. Less diagram cleanup. 1. As usual, expand Logical Model; Design Model; Use Case Realizations, Use Case Realizations – Register for Courses; then expand Register for Courses. 2. Double click Register for Courses – Basic Flow collaboration diagram 3. Press F 5 to auto generate its sequence diagram. Compare this sequence diagram to the one you created previously. What do you notice? 4. Clean up Diagram: Move student to correct position; Resize and move objects if. Introduction needed. Add notes to diagram, if desired. to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 27

Check for Unresolved Objects The Show Unresolved Objects report indicates that this object is

Check for Unresolved Objects The Show Unresolved Objects report indicates that this object is not attached to a class Check for unresolved objects: 1. Expand logical view; design model, UC Realizations, expand UCR – Register for Courses then expand Register for Courses. 2. Double click Register for Courses – Basic Flow collaboration diagram 3. On the Reports Menu, click Show Unresolved Objects. What happens? You have an object that is not attached to a class. From the browser, simply drag the : Registration. Controller class onto the object. 4. Run the report again. Message: “No Unresolved Items Found” is displayed. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 28

Check for Unresolved Messages The Show Unresolved Message report indicates that this message is

Check for Unresolved Messages The Show Unresolved Message report indicates that this message is not attached to an operation Check for unresolved messages 1. In the browser, expand the Logical View, Design Model, UC Realizations, Expand Use Case Realizations - Register for Courses; expand Register for Courses. 2. Double-click Register for Courses - Basic Flow sequence diagram. 3. On the Report menu, click Show Unresolved Messages. What happens? 4. You have a message that is not attached to an operation. Right- click the message arrow, then click //is registration open? ( ) from the list of operations. 5. Run the report again. The message “No Unresolved Items Found” is displayed. Now, let’s check for unresolved messages using a script. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 29

Run Script to Check Messages Green start arrow is pressed Scripting window is displayed

Run Script to Check Messages Green start arrow is pressed Scripting window is displayed Rose. Script is a customized version of the Summit Basic. Script. It allows you to automate Rose-specific functions; and, in some cases, perform functions that are not available through the Rose interface. Run a Script to Check Messages. 1. Expand Logical View; Design, UC Realizations; Expand UC Realizations – Register for Courses, then expand Register for Courses. Double click Register for Courses – Basic Flow sequence diagram. 2. On the Tools menu, click Open Script 3. Open C: Rose. SolutionsScripts, double click check_messages. Scripting Window opens 4. On the scripting toolbar, click the green start arrow to run script. Introduction to Rational Rose 2000 v 6. 5 30 1999 Rational Software, all. Viewport rights reserved 5. Copyright The©Basic. Script is displayed.

Run Script to Check Messages Unresolved message detected You have a message that is

Run Script to Check Messages Unresolved message detected You have a message that is not attached to an operation. You can now follow the same steps as before to assign an operation to the message. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 31

Next: Although a little out of sequence, we will create a class and add

Next: Although a little out of sequence, we will create a class and add its defining characteristics. w Now that we’ve added our interaction diagrams, we need to depict the participating classes and their relationships in class diagrams called view of participating classes (VOPC). w These diagrams ensure consistency in use case implementation across subsystem boundaries. w Before continuing, let’s take a moment to review this module’s preferred practices. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 32

Preferred Practices w Diagram rules § Create interaction diagrams for each use case realization.

Preferred Practices w Diagram rules § Create interaction diagrams for each use case realization. § Create at least one main flow diagram. § Create alternate and exceptional flow diagrams for significant behavior. § Name each diagram with the flow type. § Nest multiple realizations for one use case under appropriate package. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 33

Preferred Practices w Mapping § Map objects to classes. § Map messages to operations.

Preferred Practices w Mapping § Map objects to classes. § Map messages to operations. § Map message links to a class relationships. w Readability § Add notes and scripts to increase understanding. § Move complex alternate flows to separate diagrams. § Order objects consistently on similar diagrams. Introduction to Rational Rose 2000 v 6. 5 Copyright © 1999 Rational Software, all rights reserved 34