A Visual Introduction to Using UML Sequence Diagrams for Refining Object Models
Another important feature of the sequence diagram in Figure 4 is that it includes the creation and destruction of an object. Notice that the first interaction is shown as a dashed line from the PermissionRule object to the License object. The line goes to an object rather than to the object's life line because the interaction creates the object. The License object is not at the top of the diagram because the License object does not exist until this interaction creates the License object.
Something else to notice about the License object in Figure 4 is that its life line does not go all the way down to the bottom of the sequence diagram. Instead, it ends with a . This at the bottom of a life line indicates the destruction of the object.
Other Sequence Diagram Features
The at the upper left corner of the diagram is the diagram's title. The sd at the beginning of the title indicates that the diagram is a sequence diagram.
Every interaction in Figure 4 is preceded by a sequence number. There are a variety of numbering schemes that can be used in a sequence diagram. However, the numbering used in a sequence diagram should indicate the order in which the interactions happen.
The last thing to notice about Figure 4 is the activation shown for interaction 1.3. This is a call to an operation associated with the PermissionRule object while there is already on operation in progress associated with the same object. Because the operations associated with the same object are nested in time, the activations are shown as nested.
This article has shown you how to use UML to model interactions and other dynamic relationships between objects. During the object-oriented design process, discovering and modeling the interactions and relationships is a way to refine your object model. The sequence diagram features you have learned about are sufficient for modeling most programs.
The UML specification specifies other features to express additional subtleties and to make sequence diagrams more compact. Some modeling tools extend sequence diagrams to capture lower-level details.
About the Author
|Mark Grand is a consultant and book author with over 30 years of experience who specializes in Distributed Systems, Object-Oriented Design, and Java. He was the architect of the first commercial business-to-business e-commerce product for the Internet.
Mark Grand is most widely known for his best selling design pattern books. Mark has taught for U.C. Berkeley, Sun, and other organizations.
Mark is based in the Atlanta area. He has been involved with object-oriented programming and design since 1982.
Page 3 of 3