Software Engineering
Interaction Diagrams

Agenda

Course Map


Interaction Diagrams


Lifelines


Messages


Sequence Diagrams

Sequence diagrams show interactions between lifelines as a time-ordered sequence of events.

A sequence diagram is an interaction diagram that details how operations are carried out -- what messages are sent and when. Sequence diagrams are organized according to time. The time progresses as you go down the page. The participants (lifelines) involved in the operation are listed from left to right according to when they take part in the message sequence.

Below is a sequence diagram for adding a course. The lifeline initiating the sequence of messages is :Registrar

The :Registrar sends a addCourse("UML) message to a :RegistrationManager. The :RegistrationManager then sends a create() message to the Course class.

In the diagram Delete Course, the :RegistrationManager issues a self call to determine if a course is available. If so, then the :RegistrationManager destroys a uml:Course.


Combined Fragments and Operators

 


Branching with opt and alt

opt: creates a single branch
if (condition) then 
    op1()
alt: creates multiple branches
if (condition1) then
    op2()
else if (condition2) then
    op3()
else
    op4()


Iteration with loop and break

 


Communication Diagrams

Communication diagrams are also interaction diagrams. They convey the similar information as sequence diagrams, but they focus on participant roles instead of the times that messages are sent. In a sequence diagram, participant roles are the vertices and messages are the connecting links.

The participant -role rectangles are labeled with either class or object names (or both). Class names are preceded by colons ( : ).

Each message in a collaboration diagram has a sequence number. The top-level message is numbered 1. Messages at the same level (sent during the same call) have the same decimal prefix but suffixes of 1, 2, etc. according to when they occur.