Section 7.1. Participants in a Sequence Diagram


7.1. Participants in a Sequence Diagram

A sequence diagram is made up of a collection of participantsthe parts of your system that interact with each other during the sequence. Where a participant is placed on a sequence diagram is important. Regardless of where a participant is placed vertically, participants are always arranged horizontally with no two participants overlapping each other, as shown in Figure 7-2.

Figure 7-2. At its simplest, a sequence diagram is made up of one or more participantsonly one participant would be a very strange sequence diagram, but it would be perfectly legal UML


Each participant has a corresponding lifeline running down the page. A participant's lifeline simply states that the part exists at that point in the sequence and is only really interesting when a part is created and/or deleted during a sequence (see "Participant Creation and Destruction Messages" later in this chapter).

7.1.1. Participant Names

Participants on a sequence diagram can be named in number of different ways, picking elements from the standard format:

 name [selector] : class_name ref decomposition 

The elements of the format that you pick to use for a particular participant will depend on the information known about a participant at a given time, as explained in Table 7-1.

Table 7-1. How to understand the components of a participant's name

Example participant name

Description

admin

A part is named admin, but at this point in time the part has not been assigned a class.

: ContentManagementSystem

The class of the participant is ContentManagementSystem, but the part currently does not have its own name.

admin : Administrator

There is a part that has a name of admin and is of the class Administrator.

eventHandlers [2] : EventHandler

There is a part that is accessed within an array at element 2, and it is of the class EventHandler.

: ContentManagementSystem ref cmsInteraction

The participant is of the class ContentManagementSystem, and there is another interaction diagram called cmsInteraction that shows how the participant works internally (see "A Brief Overview of UML 2.0's Fragment Types," later in this chapter).


The format used when creating names for your participants is totally up to youor maybe your company's style guide. In this book, we lowercase the first word in the participant name to make sure that there is as little confusion as possible with the name of a class. However, this is just our conventionsimilar to the conventions used when naming objects and classes in Javaand is not something specified by UML.

What Happened to Objects?

In UML 1.x, participants on an interaction diagram were usually software objects in the traditional object-oriented programming sense. Each object was an instance of a class, and the object name was underlined to indicate this. Because UML 2.0 is more of a general system modeling language, it makes much more sense to think of it in terms of system parts interacting with each other rather than software objects. This is why we've used the term "participant" to describe a part that is involved in the interactions on a sequence diagram. A participant could still be a software object, a la UML 1.x, but it could equally be any other part of the system in keeping with the spirit of UML 2.0.





Learning UML 2.0
Learning UML 2.0
ISBN: 0596009828
EAN: 2147483647
Year: 2007
Pages: 175

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