Rational Rose Tutorial - Kennesaw State...

21
1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science University of Texas at San Antonio This tutorial will get you started working with Rational Rose. Diagrams to be covered are use case diagrams, class diagrams, sequence diagrams, collaboration diagrams, and statechart diagrams. The executable for Rational Rose is located at /usr/local/bin/rose. If your search path is not set to this directory, do the following: Under tcsh: type “setenv PATH $PATH /:/usr/local/bin” or Under bash: type “export PATH=$PATH:/usr/local/bin”. To start Rose, simply type “rose” in any Solaris machine at CS Sun Lab. After starting Rational Rose, it prompts for creating new model. There are some templates for your model. In this tutorial, we select J2EE template. If you have existing models, select “Existing” tag or “Recent” tag to retrieve them.

Transcript of Rational Rose Tutorial - Kennesaw State...

Page 1: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

1

Rational Rose Tutorial

Chia-Tien Dan Lo

Department of Computer Science University of Texas at San Antonio

This tutorial will get you started working with Rational Rose. Diagrams to be covered are use case diagrams, class diagrams, sequence diagrams, collaboration diagrams, and statechart diagrams. The executable for Rational Rose is located at /usr/local/bin/rose. If your search path is not set to this directory, do the following: Under tcsh: type “setenv PATH $PATH/:/usr/local/bin” or Under bash: type “export PATH=$PATH:/usr/local/bin”. To start Rose, simply type “rose” in any Solaris machine at CS Sun Lab. After starting Rational Rose, it prompts for creating new model. There are some templates for your model. In this tutorial, we select J2EE template. If you have existing models, select “Existing” tag or “Recent” tag to retrieve them.

Page 2: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

2

Then, three packages are created automatically. They are java, javax, and org. Java package contains basic Java classes; javax contains Java extension classes such as swing, servlet, etc. Package org contains CORBA stuff.

There are couple windows in Rose. Each is referred as a name as shown in the following figure.

Page 3: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

3

First, we create actors. From Brower area, click “Use Case View” -> “Main”. To create Actors, click Actors in Diagram Toolbox and draw it in Diagram Window.

Page 4: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

4

Type it in the name of the actor or select from the combo box.

Page 5: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

5

Do the same thing for these actors: professor, student and billing system. Then, click “Use Case” on the Diagram Toolbox and draw it on Diagram Window.

Page 6: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

6

Click “Unidirectional Association” on the Diagram Toolbox and draw it on the Diagram Window.

Page 7: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

7

Some use cases can be reused for other use cases. For example, “logon validation” can be used for both “register for courses” and “maintain schedule”. Therefore, a “generalization” (uses) relation can be modeled. Click “Generalization” on the Diagram Toolbox and draw it from “register for courses” to “logon validation” and from “maintain schedule” to “logon validation”.

Page 8: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

8

The use case is documented in each oval. Double click on “Logon Validation” and key in the use case document.

Page 9: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

9

Next, we will create a sequence diagram which displays object interactions arranged in a time sequence. From top menu, select “Browse” -> “Interactio n Diagrams…” -> “Use Case View” -> <New> -> Ok. Type in the title of the sequence name, “addCourse”, and select “Sequence” and click Ok.

Page 10: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

10

Check Browser area, an AddCourse icon appears under Use Case View. Plus, all the actors we’ve just created are there. Click Student and drag it to the Diagram Window. Right click on the Diagram Windows and select “Class Wizard…” to create “registration form” class. Do the same procedure for “registration manager”, “math 101”, and “math 101 section 1”.

Page 11: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

11

Fill in object message. Click “Object Message” and draw it on the Diagram Window.

Page 12: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

12

Next, we will create a collaboration diagram which displays object interactions organized around objects and their links to one another. From top menu, select “Browse” -> “Interactio n Diagrams…” -> “Use Case View” -> <New> -> Ok. Type in the title of the collaboration diagram name, “SetCourseInfo”, and select “Collaboration” and click Ok. The “SetCourseInfo” collaboration diagram name appears under “Use Case View”.

Page 13: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

13

Click “Object Link” from Diagram Toolbox and draw it on the Diagram Window.

Page 14: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

14

Click “Link Message” from Diagram Toolbox and draw it on the Diagram Window. Type in suitable names.

Page 15: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

15

On Browser Area, click “Logical View” -> “Package Hierarchy” to view Class Diagram.

Page 16: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

16

From the addCourse sequence diagram, we know the RegistrationManager class has to have an addCourse() operation. Double click RegistrationManager Class and click “Operations”. Right click to insert operation “addCourse” with return type Boolean.

Page 17: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

17

Add other operations accordingly. Double click Student from Browser area and choose attributes. Right click to insert name and major attributes.

Page 18: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

18

From interaction diagrams, relations among classes can be found. For example, RegiatraionManager depends on ScheduleAlgorithm and RegistrationForm is associated with RegistrationManager. The multiplicity of an association can be defined by right clicking the association link. Note that when click toward to an end of an association, the corresponding multiplicity is entered.

Page 19: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

19

Under “Logic View” -> “RegistrationManager” -> “addCourse”, right click “addCourse” -> New -> StateChart Diagram to create state transition diagram for addCourse.

Page 20: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

20

Draw the states first, draw state transition, and set event, action, and conditions accordingly.

Page 21: Rational Rose Tutorial - Kennesaw State Universityksuweb.kennesaw.edu/~dlo2/research/Rose/RoseTutorial.pdf · 1 Rational Rose Tutorial Chia-Tien Dan Lo Department of Computer Science

21