UML Sequence Diagram

From Training Material
Jump to navigation Jump to search


Interaction⌘

  • An interaction is a unit of behavior that focuses on the visible exchange of information between participants (limited in time).
  • 4 interaction diagrams in UML 2.0:
    • Sequence diagrams - sequence in which messages are exchanged
    • Communication diagrams - relationship between the participants
    • Timing diagrams - state changes of the participants relative to the time
    • Interaction overview diagrams - order of interactions in an activity-like notation

Sequence Diagram⌘

SimpleSequenceDiagram.png

  • Participants are represented by a rectangle and a dashed line (lifeline)
  • Messages are represented by arrows between lifelines
  • Time runs from top to bottom
  • The entire diagram represents one interaction

Connectable Element⌘

Lifeline.png

Connectable Element

  • a set of instances
  • can be considered as objects of the specified type
  • lifelines (participants) represent connectable elements

Execution Specification (Execution Occurrence)⌘

ExecutionSpecification.png

  • Specification of the execution of a unit of behavior within the lifeline.
  • Sending and receiving messages determine start and end of execution specification.

Message⌘

SequenceDiagramMessage.png

Message Types⌘

  • Synchronous message (filled arrowhead):
    • caller waits until called behavior terminates
    • reply message is represented by dashed line with either an open or filled arrow head
  • Asynchronous message (open arrowhead):
    • caller doesn't wait but continues after call, no reply
  • Found message (open arrowhead originating from a filled circle):
    • receiver known, sender not known
  • Lost message (open arrowhead pointing to a filled circle)
    • sender known, receiver not known
  • Create message (dashed line with open arrowhead pointing to header of lifeline):
    • new lifeline is created at this point in the diagram
  • Delete message (open arrowhead):
    • object destruction, stop (destruction of an object is represented by a cross on the lifeline)

Event Occurrences⌘

SequenceEventOcc.png

  • send event is denoted by an exclamation mark (!p)
  • receive event is denoted by question mark (?p)
  • A valid sequence for the interaction: < !p, ?p, !q, ?q >
  • It's not the only valid sequence!

Event Occurrences valid trace⌘

SequenceEventOcc2.png

Event Occurrences Rule⌘

  • Send event before receive event
  • The order of events along one lifeline is relevant.
  • The position of one event relative to an event on another lifeline is insignificant.