Slides4 InteractionDiagrams
Slides4 InteractionDiagrams
design
Module 4: Interaction Diagrams
Objectives
• Describe dynamic behavior and show how
to capture it in a model.
• Demonstrate how to read and interpret:
– A sequence diagram
– A communication diagram
• Explain the similarities and differences
between communication and sequence
diagrams.
Objects Need to Collaborate
• Objects are useless unless they can
collaborate to solve a problem.
– Each object is responsible for its own
behavior and status.
– No one object can carry out every
responsibility on its own.
• How do objects interact with each other?
– They interact through messages.
Objects Interact with Messages
• A message shows how one object asks
another object to perform some activity.
Message
getCourseOfferings(forSemester)
: Car buyer
:RegistrationController :CourseCatalogSystem
What is an Interaction Diagram?
• Generic term that applies to several
diagrams that emphasize object
interactions
– Sequence Diagram
– Communication Diagram
• Specialized Variants
– Timing Diagram
– Interaction Overview Diagram
Interaction Diagrams
• Sequence Diagram
– Time oriented view of object
interaction
Sequence Diagrams
• Communication Diagram
– Structural view of messaging Communication
objects Diagrams
Interaction Diagrams
• Timing Diagram
– Time constraint view of
messages involved in an
interaction Timing Diagrams
Sequence Diagram
Example: Sequence Diagram
1: create schedule( )
2: get course offerings( )
3: get course offerings(forSemester)
4: get course offerings( )
ref
Select Offerings
Sequence Diagram Contents:
Objects
:RegisterForCoursesForm :RegistrationController SWTSU Catalog :
CourseCatalogSystem
Lifelines
Sequence Diagram Contents:
Actor
:RegisterForCoursesForm :RegistrationController SWTSU Catalog :
CourseCatalogSystem
: Student : Course Catalog
Actor instances
Sequence Diagram Contents:
Messages
:RegisterForCoursesForm :RegistrationController SWTSU Catalog :
CourseCatalogSystem
: Student : Course Catalog
1: create schedule( )
1: create schedule( )
Execution
Occurrence
Sequence Diagram Contents:
Event Occurrence
:RegisterForCoursesForm :RegistrationController SWTSU Catalog :
CourseCatalogSystem
: Student : Course Catalog
1: create schedule( )
Event Occurrence
Sequence Diagram Contents:
Interaction Occurrence
:RegisterForCoursesForm :RegistrationController SWTSU Catalog :
CourseCatalogSystem
: Student : Course Catalog
1: create schedule( )
ref
Select Offerings
Where Are We?
Sequence diagrams
Communication diagrams
Interaction diagram
comparison
What Is a Communication Diagram?
• A communication diagram emphasizes the
organization of the objects that participate in
an interaction.
• The communication diagram shows:
– The objects participating in the interaction.
– Links between the objects.
– Messages passed between the objects.
Communication Diagrams
Example: Communication
Diagram
5: display course offerings( )
6: display blank schedule( )
: Student
2: get course offerings( )
4: get course offerings( )
: RegistrationController : CourseCatalogSystem
Communication Diagrams
Contents: Objects
: RegisterForCoursesForm
Objects
Actors
: Student
2: get course offerings( )
4: get course offerings( )
: RegistrationController : CourseCatalogSystem
Where Are We?
Sequence diagrams
Communication diagrams
Interaction diagram
comparison
Sequence and Communication
Diagram Similarities
• Semantically equivalent
– Can convert one diagram to the other without
losing any information
• Model the dynamic aspects of a system
• Model a use-case scenario
Sequence and Communication
Diagram Differences
Sequence Communication
diagrams diagrams
Show the explicit Show relationships in
sequence of messages addition to interactions
Show execution Better for visualizing
occurrence patterns of
Better for visualizing communication
overall flow Better for visualizing all
Better for real-time of the effects on a given
specifications and for object
complex scenarios Easier to use for
brainstorming sessions
Review
What is the purpose of an interaction
diagram?
What is a sequence diagram? A
communication diagram?
What is a timing diagram? An
interaction overview diagram?
What are the similarities between
sequence and communication
diagrams?
What are the differences between
sequence and communication
diagrams?