UML 2 For Dummies
Exposing an Actor’s Roles
Actors are not shy; they have to be shown to their public if you want to get their value. Within UML, the notation for an actor is traditionally a stick figure, as you can see on the left of Figure 8-2. You can also use a class box (as shown on the right of Figure 8-2) to indicate an actor—you label the box with the string «Actor». This is called stereotyping, and each « and » mark is a guillemet. You may use double angle brackets (<< and >>) if you’re typographically challenged (as are many UML tool vendors). Stereotyping is the common UML way of distinguishing similarly drawn figures of different types. The box form for an actor is similar to a class box (discussed in Chapter 3), but actors and classes are treated differently—and the stereotype «Actor» helps you recognize which is which.
Tip We recommend using the stick figure form for all the human actors and the box class box form for non-human actors (other systems, databases, and devices). This little visual convention will help you distinguish them quickly.
Sometimes you’ll find it possible to generalize your actors—especially when an “is-a” relationship (“x is a y”) exists among some actors. You can use the UML generalization notation to capture this relationship. You may also find this same type of relationship among classes. (Chapter 6 discusses the generalization relationship.)
Figure 8-3 shows an example of generalized actors. In this case, we started with looking at the actors, Potential Guest, and Frequent Traveler. We recognized that some of the essential activities of each could be generalized as those of a Reserver, as they both make reservations. As we feel that a Potential Guest “is a” Reserver and a Frequent Traveler “is a” Reserver, we use the generalization symbol to reflect the relationship.