Skip to main content

Creating effective UML diagrams has never been easier:

Using context-sensitive modeling aids in IBM Rational modeling products

Morley Tooke (mtooke@ca.ibm.com), Information Developer, IBM
Morley Tooke is an information developer at IBM Rational in Kanata, Ontario, Canada.

Summary:  This article describes how to use user-assisted modeling features such as content assist and diagram assist to create UML diagrams in IBM Rational modeling products.

Date:  10 Nov 2005 (Published 11 Oct 2005)
Level:  Introductory
Activity:  756 views

Getting started with user-assisted modeling

A typical UML model can consist of many different types of diagrams, with each diagram presenting a different view of the system that you are modeling. Each diagram type uses a different nomenclature, a different vocabulary, and a different set of elements and symbols to describe an aspect of the system. For example, a use case diagram uses actors and use cases to describe how the users interact with the system, while an activity diagram might use activity partitions to group-related activities within a larger system. Learning how to build complex UML diagrams -- and understanding the subtleties of each diagram type -- can be a challenge, particularly for the UML novice.

However, IBM® Rational® modeling products ease the work of UML modeling by providing context-sensitive tools that guide you as you create UML diagrams. Content assist is a proven Eclipse tool that prompts you with valid code syntax options while you type your code. In addition, diagram assist provides simple but powerful user interface cues that appear when you create or edit a UML diagram. These user-assisted modeling features can help you create effective, accurate UML diagrams without the steep learning curve and complex user interface of other enterprise application development suites.

Editing class diagrams with content assist

Content assist is a built-in Eclipse modeling aid that provides suggestions, displays valid code listings, and attempts to complete your code as you type it. You can use content assist to edit property types and method signatures in a class diagram. When you type the name of a property, and then type a colon (:), you will see a list of all possible return value types. Figure 1 illustrates how content assist displays complex and primitive return types, such as integers and classes, as well as UML elements and UML diagrams. To select an item in the list, use the scroll bar to view the value types and double-click a return type and complete the signature.


Figure 1. The content assist window
The content assist window

In addition to simple property return types, you can use content assist to help you create and view method signatures as you type them. When you create a method signature, content assist displays valid return types for each argument in the argument list. As you navigate through the list of valid return types, content assist displays the completed argument list before you select a return type. To complete the method signature, simply close the bracket or close the bracket, type a colon (:) and chose a return type for the method.

Content assist is simple to use. You can use this feature to create UML diagrams quickly, and it increases the accuracy of your UML diagrams by prompting you with valid return types. while displaying the completed signature or code snippet as you type.

Creating UML diagrams with diagram assist

You can use diagram assist features, such as action toolbars and connector handles, to draft your diagrams and visualize your UML models quickly. As you create a UML diagram, the diagram assist feature prompts you with visual cues that form a simplified, but very powerful context-sensitive user interface. This simplified user interface increases the effective size of your screen by removing elements of the traditional user interface, such as the file menu or the palette. You can use diagram assist to create complex UML diagrams in less time, using fewer keystrokes and mouse movements.

Action toolbars appear in the diagram editor when you hover over a spot in the diagram, as shown in Figure 2. The action toolbar is a hovering toolbar that provides access to only the set of features that are specific to the context of the current diagram. In other words, the action toolbar provides a simplified, context-sensitive user interface by removing all the features that are not related to the action that you are currently performing. For example, when you hover over a class diagram, an action tool bar appears that allows you to add a class, an enumeration, an artifact, a signal, a stereotyped class, an interface, or a package. The action toolbar contains only the tasks that a typical user might perform while creating a class diagram. Action toolbars present a user interface that is both easy to learn and use. You can use the action toolbars to visualize your models and create diagrams more quickly by keeping your hands off the keyboard and by reducing the amount of time that you spend clicking through a traditional user interface.


Figure 2. The action toolbar
The action toolbar

To add a UML element to a diagram by using an action toolbar:

  1. Place the cursor in the diagram.
  2. On the action toolbar, click the icon of the model element that you want to add.

To use the action toolbar to add an attribute to a model element:

  1. Place the cursor over a model element in the diagram editor.
  2. On the action toolbar, click the icon of the attribute that you want to add and type a name for the attribute.

Action toolbars are available in all UML diagram types.

Similar to action bars, connector handles appear when you hover over a UML element in a diagram. Connector handles appear as arrowheads that you can drag onto another element in the diagram to create a relationship, as shown in Figure 3. You can use connector handles to model the relationship between two UML elements, or to create a relationship to a new UML element.

Like action bars, connector handles are available in all UML diagram types.


Figure 3. Modeling a relationship by using a connector handle
Modeling a relationship by using a connector handle

To connect two existing model elements:

  1. Place the cursor over a model element in the diagram editor.
  2. After the connector handles appear, click a handle and drag it to the model element to which you want to connect it, and click a type of relationship.

To connect an existing model element to a new model element:

  1. Place the cursor over a model element in the diagram editor.
  2. After the connector handles appear, click a handle and drag it to an empty location in the diagram editor.
  3. Click a type of relationship and click the new type of model element.

Manually invoking diagram assist

You can manually invoke diagram assist, both action tool bars and connector handles, at any time by pressing Space.

In addition to using connector handles to create relationships, you can also use them to view all of an element's relationships in the current model by type. You can use this feature to filter and view an entity's relationships by type only, without performing a model query or creating a new browse diagram. To view an entity's relationships, place the cursor over a model element in the diagram editor. After the connector handle appears, double-click a handle and click a relationship type to view all associated relationships of that type.

Connector handles greatly increase the speed at which you can create UML diagrams. By providing the relevant tasks with one mouse click, you can quickly model relationships and create model elements without searching through menus or the Palette for a relationship or element type. You can also use connector handles to view relationships in the diagram by type.

Viewing dynamic data in the Properties view

While it's important to visualize your UML model in a diagram, it's also important to keep track of the actual model data that forms the basis for each diagram. The Properties view shown in Figure 4 acts as the link between the visualized diagram in the diagram editor and the semantic model data in the Model Explorer view. As you create and edit UML elements in the diagram editor, the Properties view dynamically displays the semantic details of the current element.


Figure 4. The Properties view
The Properties view

The Properties view contains a set of pages that you can use to edit the properties of the model element. The General page displays the name and type of the element as well as the visibility and scope of the element. You can apply profiles to the model element on the Profiles page. The Advanced page contains a tree view of all of the model's attributes. You can use the Properties view to edit attribute properties, change the appearance properties of the current element, or create documentation for the element.


Practice makes perfect

User-assisted modeling features make creating complex UML diagrams in Rational modeling products an easy exercise. You can use content assist to quickly create and edit member signatures in UML class diagrams. You can use diagram assist to add UML elements and relationships to diagrams with one mouse click. These features provide a simplified, but very powerful alternative to the standard user interface, which you can use to create UML diagrams very quickly. Because of their simple design and context-sensitive nature, they are also easy to learn and quick to master.

Without question, the best way to familiarize yourself with user-assisted modeling is to practice. You should try to create a UML diagram by using the user-assisted modeling features that are discussed in this article. You will soon realize that the user-friendly interface design of Rational modeling products extends further than content assist and diagram assist. After you master action toolbars and connector handles, and after you use content assist to build a library of Java classes, you will wonder how you ever modeled without them.


Resources

Learn

Get products and technologies

Discuss

About the author

Morley Tooke is an information developer at IBM Rational in Kanata, Ontario, Canada.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, Architecture
ArticleID=95060
ArticleTitle=Creating effective UML diagrams has never been easier:
publish-date=11102005
author1-email=mtooke@ca.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers