Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Hello World: Rational Software Architect

Design a simple phone book application

Tinny Ng (, Advisory Software Developer, IBM Toronto
Tinny Ng
Tinny Ng is a scenario architect at the IBM SWG Scenario Analysis Lab, whose mission is to improve the cross-brand integration capability of IBM SWG products. She has more than 10 years of experience in software development, from design to implementation, including application building, packaging, testing, and support.
(An IBM developerWorks Contributing Author)

Summary:  Welcome to the first tutorial in the "Hello, World! Series", which will provide high-level overviews of various IBM software products. This tutorial introduces you to IBM Rational Software Architect, and highlights some basic features of Rational Software Architect with a hands-on exercise. Learn how to design an application using UML diagrams, publish the model information into a Web page, and transform the design to Java code using Rational Software Architect.

View more content in this series

Date:  05 May 2006
Level:  Introductory PDF:  A4 and Letter (703 KB | 24 pages)Get Adobe® Reader®

Activity:  48713 views

Transforming UML to Java

The transformation function is a key feature of Rational Software Architect. You can transform the design from UML to C++, CORBA, EJB code, JACL, Java code, and so on, and begin your implementation phase with a head start. In this section, you'll transform the UML design into Java code where you can fill in the programming details and run the application.

Would you like to see these steps demonstrated for you?

Show me Show me

  1. In the Model Explorer view, right-click Phone Book UML Model and select Transforms > UML to Java.
  2. Select Create new Target Container...
  3. In the New Java Project panel, enter PhoneBookJavaProject as the Java project name, and select Create separate source and output folder. Select Finish.
  4. Select Run to start the transformation.
  5. In the Model Explorer view, a Java project PhoneBookJavaProject is created automatically with three Java files underneath.

    Figure 17. Generated Java project
    Phone book application

Let's take a look at the, shown below. The generated class has two attributes, phonebookmodel and phonebookview, which are generated as a result of the directed association and association relationships, respectively. The two operations (userHasInput and start) that you added earlier when drawing the class diagram are also generated.

You can modify the files to implement the application based on the design infrastructure. A sample implementation is in the Downloads section. It implements a line command interface and stores the phone entries into a local file.

The design just lays out the infrastructure, which can lead to many different implementations. For example, you can create a GUI interface instead of a line command interface, store the data with EJB components instead of to a file, or use the Observer pattern to implement the notification mechanism. The provided sample implementation is just one of many ways to implement the design.

Now copy and paste the sample implementation.

  1. Select File > Save All to save everything.
  2. Select PhoneBookController, then select Run > Run As ... > Java Application to run the phone book implementation as a Java application.
  3. Go to the Console view, as shown in Figure 18, and interact with the application. Validate that you can perform the two use cases, Add an entry and Search for a phone number, that were discussed earlier. Remember, the purpose of use cases is to define the behavior of a system and capture the requirements. It is important that the implementation fulfills the requirements, and is working as expected.

    Figure 18. Running the sample phone book application
    Running the sample phone book application

10 of 14 | Previous | Next


Zone=Rational, Java technology
TutorialTitle=Hello World: Rational Software Architect