rational rose tutorial - kennesaw state...
TRANSCRIPT
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.
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.
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.
4
Type it in the name of the actor or select from the combo box.
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.
6
Click “Unidirectional Association” on the Diagram Toolbox and draw it on the Diagram Window.
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”.
8
The use case is documented in each oval. Double click on “Logon Validation” and key in the use case document.
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.
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”.
11
Fill in object message. Click “Object Message” and draw it on the Diagram Window.
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”.
13
Click “Object Link” from Diagram Toolbox and draw it on the Diagram Window.
14
Click “Link Message” from Diagram Toolbox and draw it on the Diagram Window. Type in suitable names.
15
On Browser Area, click “Logical View” -> “Package Hierarchy” to view Class Diagram.
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.
17
Add other operations accordingly. Double click Student from Browser area and choose attributes. Right click to insert name and major attributes.
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.
19
Under “Logic View” -> “RegistrationManager” -> “addCourse”, right click “addCourse” -> New -> StateChart Diagram to create state transition diagram for addCourse.
20
Draw the states first, draw state transition, and set event, action, and conditions accordingly.
21