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.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- 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.
Get products and technologies
- 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.
- Join the discussion in the Rational Development Tools forum on developerWorks and the Using Design Management forum on Jazz.net.
- Rate or review Rational software. It's quick and easy.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. Find out what makes a good developerWorks article and how to proceed.
- Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Get connected. Join the Rational community to share your Rational software expertise and get connected with your peers.
Dig deeper into Rational software on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Keep up with the best and latest technical info to help you tackle your development challenges.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.