You are on page 1of 12


STEPS FOR FORWARD ENGINEERING Press Start Programs Rational Rose Enterprise Edition Rational Ente+-rprise Edition

Step 2:

When the Rational Rose window appears as shown below click on Cancel

Step 3: The screen will be as shown below. To create a new class select the class Icon from Tool box which is left side of the Canvas and click in the class diagram window.

Step 4: The screen will appear as shown below with a Newclass, set an appropriate name for the class in the first compartment of the class. Then click elsewhere in the canvas to leave the control from the class.

Step 5: Once again select the class, right click in the second compartment of the class, and select New Attributes option as shown below

Now the screen appears as shown below. Give the appropriate variable name, its data type by following syntax. Syntax: Variable name : data type

Now the screen appears as shown below

Step 6 : once again select the class, right click in the third compartment of the class, select New Operations option

Now the screen appears as shown below. Give the appropriate Operation name, its return type by following syntax. Syntax: Opname(parameter list) : return type

Now the screen will appear as shown

Note : Check the taskbar of the Rational Rose at the bottom of the screen, if the default language is set to java, you need not to perform this step else do as explained below. This step has to be repeated only one time at the beginning while working with the Rational Rose & need not be repeated for the second time when you work with the Rational Rose Goto Tools Menu - Select Options - Notations as shown in below

Check the default notions as Unified and default language as Java in the below screen Click on Apply & OK

Now identify the change in the bottom of the screen as default language set to Java

Step 7: Now in the browser window which is left to the canvas (leftmost coloumn),

Goto Component view, right click on the component view -new component.

Set the component name as same as the class name in our example student. Now the screen appears as shown below

Now the new component student is created. Select this component and right click on it, select Open standard specifications as shown below.

Now the screen will appear as shown below with components specifications window. In this window click on Realize button, then the class name appears.

Now Right click on the class name & select Assign, After assigning we see a red colour tick on the class name as shown in the next screen.

click on OK, then component specifications window closes.

Step 8: In the browser window, select the component created i.e Student, make a right click & then go to Java /J2EE Project specifications as shown in the below window

Now we get the project specifications window, we need to create a classpath where we would like to store the code generated for the diagram. Inorder to create our working directory, select the square symbol which is beside the cross symbol, then type the directory name. System will prompt for creating a new directory, if the directory does not exits. Then click on Yes. Finally click on Apply & OK, then project specifications window closes. This is path where our source code is stored.

Step 9: Select the new component Student in the browser window, right click on it, goto Java / J2EE Generate Code option as shown below

Now we will get Assign classpath entries window, here in one coloumn, it shows the directory names and in another coloumn it shows the Java source code file names. Select the appropriate directory and click on Assign, then finally click on OK to close the window.

Now we will get the message Code generated Successfully which is the final step of the forward engineering. If any errors are there, read the log window & correct them in the class diagram & repeat the above step.

To view the source code, select the component created Student, Right click on it goto Java/J2EE Edit code. Now we will get the code window in the bottom.

The generated code window will be displayed as shown below.


1. 2.

Create a Java source code file in your working directory with out any Java syntax errors & save it as file name same as class name with extension .java. right click on the new class diagram canvas, select Java/J2EE Reverse Engineering

3. Choose the path of .java file, and select the appropriate java file for which you would like to bring the diagram

4. Now click on Add, then select Java file will appear in the below window as shown in the screen.

Now select file name with entire path in the below window, then Click on Reverse button, then click on Done.

5. Goto Logical view in the browser window, expand it by click on + symbol, then drag the class name with mouse on to the canvas. Then required class diagram will be displayed as below.