Introducing Rational Software Modeler

Gain true application visualization

This article introduces you to IBM Rational Software Modeler, a component of the IBM Software Development Platform. It explores the various models you can create in Rational Software Modeler and demonstrates how, with the integration of Eclipse and Rational Software Modeler, the Unified Modeling Language (UML) model provides a true visualization of your application. You'll also learn how to create and publish simple UML models.

Kunal Mittal (kunal@kunalmittal.com), Portal/J2EE Architect, Freelance Developer

Kunal MittalKunal Mittal is a consultant specializing in Java™, Java 2 Platform, Enterprise Edition (J2EE), and Web services technologies. He is the co-author of and has contributed to several books on these topics. Kunal is currently working on a portal project for Sony Pictures Entertainment. For more information, visit his Web site at http://www.soaconsultant.com.



11 November 2005 (First published 29 March 2005)

Also available in

Introduction

The IBM Rational Software Development Platform is an Eclipse-based common development environment that is shared by the following products:

  • IBM® Rational® Web Developer
  • IBM® Rational® Application Developer
  • IBM® Rational® Software Modeler
  • IBM® Rational® Software Architect
  • IBM® Rational® Functional Tester
  • IBM® Rational® Performance Tester

It is an integrated platform that allows you to manage and trace your project from requirements through design and development.

One component of the IBM Software Development Platform is the IBM Rational Software Modeler. Rational Software Modeler is a Unified Modeling Language (UML)-based visual modeling and design tool for architects, systems analysts, and designers who need to ensure that their specifications, architecture, and designs are clearly defined and communicated to their stakeholders. For example, the tool is designed to help users translate requirements into use cases and other artifacts, based on UML, such as class diagrams and sequence diagrams. Rational Software Modeler is a customizable tool that enables you to clearly document and communicate these system views. Rational Software Modeler also supports team development by integrating with other tools in your environment. This integration helps enable project teams to collaborate and track a project through its life cycle. Simply put, Rational Software Modeler is a UML modeling tool on steroids.


Rational Software Modeler and Eclipse

The IBM Software Development Platform is integrated with Eclipse, which results in a richer and more user-friendly toolset. Eclipse is an open source integrated development environment (IDE) that is fast gaining popularity. More and more developers are adopting Eclipse because of its usability features and development plug-ins. (For more information about Eclipse, refer to the Resources section at the end of this article.) Rational Software Modeler includes and benefits from core Eclipse paradigms such as perspectives, which enable you to switch your view to show the toolbars you need. The perspectives and features that you most often use in Rational Software Modeler are:

  • Modeling perspective: Use this view to create and manage your UML assets. All the assets that you create are Eclipse resources, which means that you can work with them using the Eclipse IDE. Rational Software Modeler allows you to build any UML diagram: use case diagrams, class diagrams, sequence diagrams, collaboration diagrams, and so on.
  • Requirements perspective: This view is for integration with IBM® Rational® RequisitePro® (discussed further toward the end of the article).
  • Model Publishing: This feature allows you to publish your model so that others can view it.

You can store either your raw UML models or the source code generated from the models. In addition, although there are no automated synchronization features between the UML models and the code, you can easily generate one from the other. This feature is great for developers because they can see an initial version of their code right from the UML diagrams, saving them up-front development time. In my experience, developers are more motivated to spend additional time during the design phase when they know that they'll get something tangible from it. (See the article Introducing Rational Software Architect, listed in the Resources section for more information about code-generation features.) So, let's jump in.


Simple UML modeling

You can use Rational Software Modeler to create basic UML models, use case diagrams, class diagrams, and sequence diagrams. You'll learn how to create use case diagrams first.

Create a use case diagram

You can use UML use case diagrams to describe the functionality of a system. Use cases have four major elements:

  • Actors: Interact with the system; typically appear as stick figures in a use case diagram (although this tool shows a graphic that looks like a person)
  • Use cases: Describe the functionality of the system; appear as ovals in the diagram
  • System: The system itself
  • Relationships: Demonstrate the relationships among the above three elements; appear as lines in the diagram

Begin by launching Rational Software Modeler (you'll gain more from this article if you follow along in the tool).

  1. From the File menu, create a new UML project called BookStore--in other words, click File > Create, then type Bookstore in the UML Project field. (As you can tell, you're going to model a simple book store.)
  2. Create a use case model under the BookStore project.

Your Rational Software Modeler window should look like that shown in Figure 1.

Figure 1. Use case model for the BookStore project
Use case model for the BookStore project

Next, create a use case diagram. First, create Versatile Actors, which are actors that will be shared across different use cases.

  1. Right-click the Versatile Actors tab, then create two actors: Customer and Administrator.
  2. Drag these actors onto the use case diagram.
  3. Using the palette, create four use cases for the Customer actor called Search Books, Browse Catalog, Order Book, and Manage Account.
  4. For the Administrator actor, create two use cases called Ship Book and Manage Catalog.
  5. Now, create an actor called System to handle payment processing.

Figure 2 shows these actors and use cases.

Figure 2. Actors and use cases for the BookStore project
Actors and use cases for the BookStore project

You've just created a basic use case diagram. Now, you need to extend that diagram to include relationships.

  1. Begin by expanding the Manage Account use case into the different pieces that make up the larger use case.
  2. Assume that the Manage Account use case is made up of two use cases: Create User Account and Edit User Account.
  3. Both of these use cases in turn consist of three detailed use cases: Update User Profile, Update Shipping Information, and Update Payment Information.

Figure 3 shows these relationships.

Figure 3. Details for the Manage Account use case
Details for the Manage Account use case

Congratulations! You've just built your first use case diagram in Rational Software Modeler, complete with actors, use cases, the system itself, and different relationships between the use cases. Now, you'll build a class diagram.

Create a class diagram

A class diagram describes the various classes in your system, as well as the relationships between those classes. Class diagrams are used for a variety of purposes. They help you:

  • Understand the requirements and describe the detailed design of your system. (Architects typically build class diagrams in collaboration with development teams, which enables the developers to understand fully what they'll be implementing.)
  • Apply design patterns and visualize how your system will behave.

Class diagrams are one of the best handshakes between architects and developers. The question is, how do you distinguish the classes from the use cases? A good rule of thumb is that each noun in your use case is a candidate to become a class in your code. (For more information about getting from use case to class diagram to code, refer to the Resources section.)

You'll perform these steps to build a class diagram called Class Diagram:

  1. Right-click the use case model in the Model Explorer.
  2. Create a class called Customer.
  3. Beneath the Customer class, create four attributes called firstName, lastName, userId, and password.
  4. Create a class called Address. (Don't worry about adding the attributes right now.)
  5. Beneath the Address class, create two more classes called BillingAddress and ShippingAddress. These classes should be generalized from the Address class (see Figure 4).
  6. Create a one-to-many relationship between the Customer class and the Address class.
  7. Create a class called CreditCard.
  8. Add three attributes to the CreditCard class called creditCardNumber, creditCardType, and creditCardExpirationDate.
  9. Create a one-to-one relationship between the CreditCard class and the BillingAddress class.
  10. Create a one-to-many relationship between the Customer class and the CreditCard class.

Figure 4 shows the class diagram you've just created. Complete your class diagram to include other classes, such as Catalog, Book, and Order. You can perform this procedure on your own as an exercise.

Figure 4. The newly created class diagram
The newly created class diagram

So far, you've created a use case diagram and a class diagram. Now, you need to create another type of diagram: a sequence diagram. UML sequence diagrams are typically used to:

  • Validate and flesh out the logic of a use case
  • Visually communicate your requirements to your developers
  • Help you understand the interaction between your objects so that you can identify potential design issues
  • Identify any complex classes or issues that require more detailed design

I think that these three elements -- use cases, class diagrams, and sequence diagrams -- are the bare essentials of any software design document. The other UML diagrams definitely have value, but given the time limitations on a project, you should create at least these three diagrams before jumping into development.

Create a sequence diagram

To create a simple UML sequence diagram:

  1. First, use the Model Explorer to create a new sequence diagram.
  2. Then, drag and drop the Customer, Address, and CreditCard classes -- and the Update User Profile use case -- onto this sequence diagram.
  3. Using the palette, create the following sequence of steps (see Figure 5).
    1. Customer calls the updateProfile method, which is part of the Update User Profile use case discussed previously.
    2. The updateProfile method then calls the updateAddress method on the Address class.
    3. The updateProfile method calls the updateCreditCard method on the CreditCard class.
    4. The updateProfile method then returns to the Customer class.
Figure 5. Newly created sequence diagram
Newly created sequence diagram

In Rational Software Modeler, you could have also chosen to create a UML collaboration diagram, which describes the interaction between objects and the order of the messages that they exchange. These diagrams are relatively quick to draw. Collaboration diagrams and sequence diagrams contain almost identical information, so it's really up to each development team and the architects as to which diagram they prefer. It's probably overkill to have both, and I prefer sequence diagrams because they are more specific about the sequence of events and, as a result, add more value. Also, building the appropriate algorithmic logic is easy from a sequence diagram. However, if your preferences run to the contrary, I recommend that you explore the collaboration diagram feature in Rational Software Modeler.


Integration with Rational RequisitePro

One key feature of the IBM Software Development Platform is its complete end-to-end integration with the software development life cycle. The Rational Suite provides this integration from a toolset perspective. Using these tools, information technology (IT) teams can collaborate -- starting with requirements and moving on to design, development, testing, and deployment -- all within the same tool framework.

Of particular importance is the integration between Rational RequisitePro and Rational Software Modeler. (For more information about Rational RequisitePro, refer to the Resources section.) This integration allows you to trace your requirements to specific elements in your design. For example, you can tie your use cases to specific requirements. Use cases are in turn tied to the class diagrams and sequence diagrams that define the application. These ties allow developers to navigate easily from design elements to requirements.

This article doesn't show you how to create your requirements in Rational RequisitePro. Instead, it assumes that you have a Rational RequisitePro project with some requirements and use cases defined. (As long as you have licenses for Rational RequisitePro and Rational Software Modeler, you don't need anything else to enable the integration.)

Now, in Rational Software Modeler, open the Requirement perspective. Use the Requirement Explorer to open your Rational RequisitePro project.

This example contains a simple Rational RequisitePro project with two requirements of type Use Case: one for Search Books and the other for Browse Catalog. In Rational Software Modeler, perform the following steps:

  1. Open the use case diagram
  2. Simply drag and drop the requirements from the Requirement Explorer onto the appropriate use case in the diagram
  3. A small arrow appears next to the name of the requirement in the Requirement Explorer to show that the requirement is linked (see Figure 6)
  4. By right-clicking the use case in the UML diagram and selecting Requirement, you'll be able to navigate directly to the requirement in Rational RequisitePro
Figure 6. Linked requirements in the Rational RequisitePro project
Linked requirements in the Rational RequisitePro project

Publish your model

Publishing your finished model to the Web is easy. Rational Software Modeler automatically generates the HTML and images from your model. (This feature is similar to Javadoc" generation in the Java" technology environment.) The output files closely resemble the format that API documentation takes -- a format familiar to all Java technology developers. Even non-Java technology developers who might not be familiar with the Javadoc tool will find it easy to navigate this structure. The output is nicely cross-linked, and you can easily navigate through all the different model assets that you have chosen to export.

To actually publish the model, click Modeling > Publish. Figure 7 shows this output in a Web browser. Rational Software Modeler also offers an option for exporting your model to Adobe® PDF format.

Figure 7. Use Rational Software Modeler to export HTML
Use Rational Software Modeler to export HTML

Summary

This article showed you how to use Rational Software Modeler to create simple use case diagrams, class diagrams, and sequence diagrams based on the UML 2.0 standards. You also learned how to tie these UML assets to requirements in Rational RequisitePro so that you can manage and trace your requirements to each design element. Finally, you saw how easy it is to export your completed model to the Web. Your published model becomes a valuable asset to the design document you build for your application.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

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

 


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

All information submitted is secure.

Choose your display name



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.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

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

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, Architecture
ArticleID=56977
ArticleTitle=Introducing Rational Software Modeler
publish-date=11112005