|
Stereotypes is extensibility mechanisms in UML which allows designers to extend the vocabulary of UML in order to create new model elements. It can be derived from an existing model element, but that have specific properties that are suitable for a particular problem domain or otherwise specialized usage.
For example, when modeling a network you might use an image icon (a symbol) for representing routers and hubs. By using stereotyped nodes you can make these things appear as primitive building blocks and make the specification much more comprehensible. Actually, a stick figure is used to present an actor in a use case diagram is a good example of using an image for presenting a stereotype in UML. The meaning of a stick figure and a stereotyped <<actor>> class are both the representing the same model element – an actor (student). In other word, these two notation are interchangeable in UML, but you can tell which one is much easier to understand. Let's go through an example for illustrating the application of this new feature: Suppose you are developing a class diagram for a database application, the diagram would have some ordinary classes as any other normal class diagrams, and at the same time, you would like to specify some stereotyped <<ORM persistable>> classes in the class diagram which are going to be stored in a database as show in the diagram pane below:  Suppose we would like to use an image icon for the persistent classes, as the way the predefined UML stereotype using stick figure to present an actor by default; we could associate an “database-tank” image to the <<ORM Persistable>> stereotype by performing the following steps: - Select Tools > Configure Stereotypes from the main menu.
From the popup Configure Stereotype dialog box, you can see the Model elements tree is expended and the Class element under the Class notes is automatically be selected.
 Select the ORM Persistable stereotype and press the Edit... button.
This popup the Stereotype Specification dialog box.
Press the [...] button beside the Icon Path section and select an image file as icon which you had prepared previously in the file directory.
The “database-tank” image icon will be appeared in the preview box
When you see the message below, confirm by pressing the Yes button and close all opening dialog boxes.
We can see the ORM Persistable classes are attached with the database tank icon.
To make the classes show as a database tank image icon, select them multiply (hold the Ctrl key down while you are clicking on those classes that you would like to select).
Then right click on anyone of those group selected classes and select Presentation Options > Stereotype Icon from the popup menu. Now, those persistable classes are shown as database tanks as shown below.
 |
|
Last Updated on Friday, 17 October 2008 01:46 |