Sei sulla pagina 1di 21

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.

1
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.

2
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.

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

4
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.

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

6
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”.

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

8
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.

9
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”.

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

11
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”.

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

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

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

15
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.

16
Add other operations accordingly.

Double click Student from Browser area and choose attributes. Right click to insert name
and major attributes.

17
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.

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

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

20
21

Potrebbero piacerti anche