Create editable sequence diagram with Rational Software Architect
Import the sample application
In working through this example, you will use the Enterprise JavaBeans (EJB) 3.0 Counter sample that is included with IBM® Rational® Software Architect to generate sequence diagrams. First, import this sample application:
- Start Rational Software Architect in a new workspace.
- Click Help and then Welcome on the menu from the workspace.
- Click the Samples icon, as shown in Figure 1, to open a window with options
- Select Counter application from the list of sample applications (Figure 2).
- Click Import sample from the help window (Figure 3).
- It the dialog window that opens, specify the folder where you want to copy the projects in Project location root.
Rational Software Architect then copies all projects of the Counter application to the specified location and imports them into workspace, as shown in Figure 4.
Figure 1. Select samples
Figure 2. Select the Counter application
Figure 3. Import the Counter sample
Figure 4. Counter sample in the workspace
Generate a non-editable sequence diagram
By default, Rational Software Architect generates a non-editable sequence diagram. Follow these steps to create the diagram:
- In the Outline tab view shown in Figure 5, select the class and method for which you want to generate sequence diagram.
Figure 5. Select the method from the list in the Outline tab
- Right-click on the method, and select Visualize > Add to New Diagram file > Static Method Sequence Diagram, as shown in Figure 6.
Figure 6. Generate a static method sequence diagram
- Specify the path to the diagram to be generated in the next window.
Rational Software Architect then generates sequence diagram as shown in Figure 7.
Figure 7. The generated sequence diagram
Limitations of a non-editable sequence diagram
Rational Software Architect generates sequence diagrams by literally converting Java code, line by line. In most of the cases, especially for complex code, the generated diagrams become too complex, so they are very difficult to understand. Therefore, we need editable sequence diagrams so that we can add abstraction, delete unnecessary elements, add comments, and so forth.
Generate an editable sequence diagram
The extension of the static diagram is .tpx, which cannot be modified. To make the diagram editable, right-click on the diagram, and select File > Save as Diagram File, as shown in Figure 8.
Figure 8. Save as Diagram File selected on the context menu
The extension of the new diagram is .dnx. Diagram files can use various extensions, but .dnx is the most common one, and the .dnx extension can be modified. As Figure 9 shows, the Palette window also appears so that you can edit the diagram.
Figure 9. Editable Sequence diagram
The author thanks Saldy Mathew from IBM India for encouraging him to transform his findings into article.
- To learn more:
- Start at the Rational Software Architect family of products page and be sure to check the developerWorks page.
- Also, explore the product ovrview, the information center for installation and use instructions, and the Rational Software Architect wiki for more resources.
- Read Sequence diagram enhancements in IBM Rational Software Architect and IBM Rational Software Modeler (developerWorks, 2009). Even though this article is about previous versions of the software, the sequence diagram information is still relevant and helpful.
- Subscribe to the developerWorks weekly email newsletter, and choose the topics to follow. Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, any time, and many of the "Getting Started" ones are free.
- Download any of these for a trial at no charge:
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.