340 likes | 354 Views
Rational Rose 2000 Interaction Diagrams. Module Objectives. Define interaction diagrams. Describe when and how to create interaction diagrams. Use Rational Rose to create interaction diagrams. Auto generate interaction diagrams. Run reports to check mapping.
E N D
Module Objectives • Define interaction diagrams. • Describe when and how to create interaction diagrams. • Use Rational Rose to create interaction diagrams. • Auto generate interaction diagrams. • Run reports to check mapping. • Run a RoseScript to check messages.
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…)
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….)
Where are we – continued. • 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.
Where are we – Architectural and Use Case Analysis • 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.)
Where are we: Use Case Design • Interaction diagrams, initially defined in use case analysis, are refined. • Analysis Classes are replaced with design subsystems and classes. • Input Artifacts: (Again, ‘some’ of these…) • Supplementary specifications; • Design Subsystems; • Use Case; • Interfaces; • Use Case Realizations; • Design Classes
Where are we – Subsystem Design • Realizations between the subsystem’s interfaces and contained classes are defined. • Detailed design of the subsystem may result in changes to the Use Case realization. • Input artifacts • Use case realizations • Design subsystem with interface definitions • Design guidelines
Key Concepts • 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 how 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.
Reports and Scripts • Reports • Show unresolved objects - lists all objects not attached to a class. • Show unresolved messages - lists all messages not attached to an operation. • Script • A RoseScript that identifies several problems with messages, including messages without operations attached to them.
Part of Deliverable #4: • Objectives of following Rose diagrams: • Create collaboration diagrams. • Constructed sequence diagrams. • Auto generate diagrams. • Run Reports to check mapping. • Run Script to check mapping.
In the browser, collaboration diagram added under its use case realization Add Collaboration Diagram - Setting up the Structure 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
In the browser, collaboration diagram added under its use case realization Collaboration Diagrams (continued) 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.)
Actor added to diagram Objects added to diagram Create a Collaboration 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: :RegisterForCoursesForm Repeat steps above for :RegistrationController Size objects if needed to fit text.
Object assigned to class Create a Collaboration diagram Assign objects to classes 1. In the browser, drag the RegisterForCoursesForm boundary class on to the RegisterForCoursesForm 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.
Object assigned to class Create a Collaboration diagram 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.
Self link added to object Link added between objects Create a Collaboration Diagram • Links - pathways for communications between objects. Can have links back to self • Add object links • From the diagram toolbar, click the Object Link icon. Drag your mouse from • Student to the :RegisterForCourseForm class • 2. Repeat step 1 to add an object link from :RegisterForCoursesForm to • to RegistrationController. • Add a self link. From the diagram toolbar, click the Link To Self icon. • Click :RegisterForCoursesForm. What happens?
Operation added to link Create a Collaboration Diagram (continued) • Select collaboration numbering • With numbering active, you must add the messages in order. • Make sure collaboration numbering is selected. • On the Tools menu, click Options. Click Diagram. • 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. )
Operation added to link Create a Collaboration Diagram ( continued) 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 :RegistrationForCourseForm. 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 :RegisterForCoursesForm’s self-link. 4. Repeat steps 1 and 2 to add a message from :RegisterForCoursesForm to :RegistrationController. 5.Move arrows and messages as needed to clean up the diagram.
Multiple operations added to link Create a Collaboration Diagram Add multiple operations 1Right-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 RegisterForCoursesForm? Note the number of messages from the actor (external) to this class.
Sequence diagram in browser Partially completed sequence diagram Create 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.
Object added to diagram Create Sequence 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 :RegistrationController. Size object to fit text.
Object assigned to class Operation added to diagram Create Sequence Diagram • Assign objects to classes • In browser, drag the RegistrationController control class on to the RegisterController object. • Add operations to messages • From the diagram toolbar, click the Object Message icon. Drag your mouse • from RegisterForCoursesForm to RegistrationController. 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? • Move arrows and messages as needed to clean up diagram. • Unlike collaboration diagrams, sequence diagrams can have only one message • between objects.
Anchor added to note Note added to diagram Create Sequence 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
Anchor added to note Note added to diagram Create a Sequence 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?
Sequence diagram generated from collaboration diagram Auto Generate Diagrams • Recommend you auto generate sequence diagrams from collaboration diagrams. • Less diagram cleanup. • As usual, expand Logical Model; Design Model; Use Case Realizations, • Use Case Realizations – Register for Courses; then expand Register for Courses. • Double click Register for Courses – Basic Flow collaboration diagram • Press F5 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 needed. Add notes to diagram, if desired.
The Show Unresolved Objects report indicates that this object is not attached to a class Check for Unresolved Objects • Check for unresolved objects: • 1. Expand logical view; design model, UC Realizations, expand • UCR – Register for Courses then expand Register for Courses. • Double click Register for Courses – Basic Flow collaboration diagram • 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 :RegistrationController class onto the object. • 4. Run the report again. Message: “No Unresolved Items Found” is displayed.
The Show Unresolved Message report indicates that this message is not attached to an operation Check for Unresolved Messages • Check for unresolved messages • 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.
Run Script to Check Messages Green start arrow is pressed Scripting window is displayed RoseScript is a customized version of the Summit BasicScript. 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:\RoseSolutions\Scripts, double click check_messages. Scripting Window opens 4. On the scripting toolbar, click the green start arrow to run script. 5. The BasicScript Viewport is displayed.
Unresolved message detected Run Script to Check Messages 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.
Next: Although a little out of sequence, we will create a class and add its defining characteristics. • 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). • These diagrams ensure consistency in use case implementation across subsystem boundaries. • Before continuing, let’s take a moment to review this module’s preferred practices.
Preferred Practices • 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.
Preferred Practices • Mapping • Map objects to classes. • Map messages to operations. • Map message links to a class relationships. • Readability • Add notes and scripts to increase understanding. • Move complex alternate flows to separate diagrams. • Order objects consistently on similar diagrams.