OCUP2F 07 Sequence Diagram

From Training Material
Jump to navigation Jump to search

Module 7. Sequence Diagram⌘

Interaction⌘

  • Interactions are units of behavior of an enclosing Classifier.
  • Interactions focus on the passing of information with Messages between the Connectable Elements of the Classifier.
  • 4 interaction diagrams in UML 2.5:
    • 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⌘

  • Participants are represented by lifeline - a rectangle and a dashed line
  • Messages are represented by arrows between lifelines
  • Lifeline describes the time-line for a process, where time increases down the page
  • The entire diagram represents one interaction

Connectable Element⌘

Connectable Element

  • a set of instances
  • can be considered as objects of the specified type
  • lifelines (participants) represent connectable elements (properties)
  • If the referenced part has a multiplicity > 1, then the lifeline may have selector that specifies which particular part is represented by this lifeline

Occurrence Specification ⌘

  • Occurrence Specification represents a moment in time at the beginning or end of a message or at the beginning or end of an execution.
  • The semantics of an Interaction is given as a trace (a sequence of event occurrences).

Execution Specification ⌘

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

Message⌘

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⌘

  • Sequence of event occurrences (trace) is defined by <eventoccurrence1, eventoccurrence2, ...,eventoccurrence-n>
  • 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⌘

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.