Stereotypes

Stereotypes

Stereotypes are the core extension mechanism of the UML. If you find that you need a modeling construct that isn't in the UML but is similar to something that is, you treat your construct as a stereotype of the UML construct.

An example of this is the interface. A UML interface is a class that has only public operations with no method bodies or attributes. This corresponds to interfaces in Java, COM, and CORBA. Since it's a special kind of class, it is defined as a stereotype of class. (See "Interfaces and Abstract Classes" on page 90 for more about interfaces.)

Stereotypes are usually shown in text between guillemets (for example, «interface »), but you can also show them by defining an icon for the stereotype.

Many extensions to the core UML can be described as a collection of stereotypes. Within class diagrams, these might be stereotypes of classes, associations, or generalizations . You can think of the stereo-types as subtypes of the meta-model types Class, Association, and Generalization.

I've noticed that people using the UML tend to confuse constraints and stereotypes. If you mark a class as abstract, is that a constraint or a stereotype? The current official documents call it a constraint, but you should be aware that there is a blurred usage between the two. This is not surprising, as subtypes are often more constrained than supertypes.

An effort is under way at the OMG to create UML profiles. A profile takes a part of the UML and extends it with stereotypes for a particular purpose. The OMG has started with such things as a real-time profile and a CORBA Interface Definition Language (IDL) profile. I'm sure that more will follow.



UML Distilled[c] A Brief Guide to the Standard Object Modeling Language
The Unified Modeling Language User Guide (Addison-Wesley Object Technology Series)
ISBN: 0201571684
EAN: 2147483647
Year: 2005
Pages: 119

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net