The Agile Modeling (AM) Method

UML Stereotypes: Diagramming Style Guidelines

A stereotype denotes a variation on an existing modeling element with the same form but with a modified intent. Stereotypes are effectively used to extend the UML in a consistent manner.
Figure 1. Indicating stereotypes.
Figure 2. A frame encompassing a sequence diagram.

  1. Name Stereotypes in <> and <> format.
  2. List Stereotypes Last. In Figure 1 the second version of the Customer class lists the stereotypes for its operations after the operation signature, not before it.
  3. Don’t Indicate Assumed Stereotypes. In Figure 1 I dropped the <> stereotype because it is common practice to assume that unless marked otherwise that a class is a business domain one.
  4. Prefer Naming Conventions over Stereotypes. For example, instead of applying the stereotype <> on an operation, you could simply start all getters with the text get. This simplifies your diagrams and increases the consistency of your source code. Normally would have ditched <> in Figure 1 but I left it there for the discussion of Tagged Values Follow Stereotypes.
  5. Tagged Values Follow Stereotypes.
  6. Center Classifier Stereotypes. The stereotype for a classifier, such as the Customer class in Figure 1 should be centered (as should the name itself).
  7. Introduce New Stereotypes Sparingly.
  8. Apply Stereotypes Consistently.
  9. Apply Visual Stereotypes Sparingly. Figure 2 depicts a sequence diagram which includes the standard robustness diagram symbols which are commonly applied to UML communication diagrams.

Source

Material for this article was summarized from The Elements of UML 2.0 Style.

Modeling style: Elements of UML 2.0 Style The Elements of UML 2.0 Style describes a collection of standards, conventions, and guidelines for creating effective UML diagrams. They are sound, proven strategies that lead to diagrams that are easier to understand and work with. These conventions exist as a collection of simple, concise guidelines that if applied consistently, represent an important first step in increasing your productivity as a modeler. This book is oriented towards intermediate to advanced UML modelers. Although there are numerous examples throughout the book it would not be a good way to learn the UML (instead, consider The Object Primer). The book is 188 pages long and is conveniently pocket-sized so it’s easy to carry around.