![]() |
![]() |
![]() |
![]() |
Naming Model Elements Naming Model Elements
You can name model elements with any combination of characters that are meaningful to you. Depending on the model element and its location, you may or may not be restricted to unique names.
For example, actors, use cases, classes, components, and packages that reside in different packages do not require unique names. When different elements have the same name, the elements are said to be "overloaded."
Overloading gives you the flexibility of using existing software libraries that may have the exact names you have in your code or in another software library.
Overloading also allows you to do multi-lingual, component-based development. For example, an application can be modeled even if the GUI for screen input is in VB or Java, the processing is in C++, and the database in Oracle. In this example, each application can have its definition of a class "Customer" do different things.
Another useful feature of overloading is the ability to have actors in the use-case view and classes in the logical view with the same name.
When naming an element, it is important to note that in some cases an overloaded element is created, while in other cases, the existing element with the same name is used (and therefore an overloaded element is not created).
To name an element on the diagram:
- 1 Create a new element on the diagram from the toolbox.
- 2 Type in a name. As soon as you start typing, a pop-up box listing all the available class names in the model is displayed.
You can select one of the highlighted names by double-clicking a name or by pressing the enter or tab key. Otherwise, you can continue typing (and click outside the edit area) to enter a new name.
- If you do not want to see this window, you can turn this option off. To do so, click Tools > Options. Click the Diagram tab. Under the Miscellaneous section on the lower left, click Class Name Completion to turn the feature off.
To create/name an overloaded element on the diagram:
If you want to create an overloaded element name on the diagram, you must enter the name through the specification. If you instead enter the duplicate name on the element in the diagram, you will be using an existing element rather than creating a new one with its own characteristics.
- 1 Create a new element on the diagram from the toolbox.
- 2 Double-click the element or click Browse > Specification, to display the specification.
- 3 Type a name in the name field.
- 4 Click OK.
If this name already exists in another package, a warning dialog is displayed telling you the name of the element and type already exists in another package. For example: "Class AA now exists in multiple name spaces."
You can dismiss this box either by clicking Cancel which ignores the name or OK. If you do not want to see the dialog box anymore, select the Don't warn anymore this session check box. To start seeing the dialog box again, restart the application.
The element is now named with a duplicate name, but has its own unique characteristics.
To place an overloaded element on the diagram from the browser:
From the browser, drag the element onto the diagram.
If the element belongs to a parent different from the diagram, and Show Visibility is on, the element is annotated with the term `(from x)' where x is the element's location. If Show Visibility is off, only the element name is displayed.
A fully qualified name is displayed as you place your pointer over the model element. A fully qualified name consists of the element hierachy (starting at the package level), where each level is separated by double colons. For example, Logical View::Package B::Class 1 is a fully qualified name.
- 1 Click the name of an icon to display the insertion point (flashing vertical bar).
- 2 Backspace and type additional text.
Note: Stereotypes in the form <<stereotype>> are extracted from the name of an item when you edit it.
- 3 Click outside the named icon.
Alternatively, you can double-click an icon to display its specification; modify the Name field, and click OK.
If double-clicking a logical package icon displays the main class diagram, click Tools > Options, and then click the Diagram tab. Clear the Double-Click to Diagram check box. With this option turned off, double-clicking a package will display the specification.
Rational Software Corporation
http://www.rational.com support@rational.com docs@us.ibm.com Copyright © 1993-2000, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |