UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared...
Transcript of UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared...
![Page 1: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/1.jpg)
UML Interactions
![Page 2: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/2.jpg)
Charles ANDRE - UNSA2
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 differencesbetween communication and sequence diagrams.
![Page 3: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/3.jpg)
Charles ANDRE - UNSA3
Objects needs 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.
![Page 4: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/4.jpg)
Charles ANDRE - UNSA4
Interactions (1)• Interactions are used in a number of different situations. • They are used to get a better grip of an interaction
situation for an individual designer or for a group that needs to achieve a common understanding of the situation.
• Interactions are also used during the more detailed design phase where the precise inter-process communication must be set up according to formal protocols. When testing is performed, the traces of the system can be described as interactions and compared with those of the earlier phases.
• An interaction can be displayed in several types of diagrams:– Sequence Diagrams, – Interaction Overview Diagrams, – Communication Diagrams,– Timing Diagrams.
![Page 5: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/5.jpg)
Charles ANDRE - UNSA5
Interactions (2)• Interaction diagrams emphasize the communication
between objects, not the data manipulation associated with that communication.
• Focus on specific messages between objects and how these messages come together to realize functionality.
• A message shows how one object asks another object to perform some activity.
![Page 6: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/6.jpg)
Charles ANDRE - UNSA6
Interaction diagrams (1)
• Sequence Diagram– Time oriented view of
object interaction
• Communication Diagram– Structural view of
messaging objectsCommunication
Diagrams
Sequence Diagrams
![Page 7: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/7.jpg)
Charles ANDRE - UNSA7
Interaction diagrams (2)
• Timing Diagram– Time constraint view
of messages involved in an interaction
• Interaction Overview Diagram– High level view of
interaction sets combined into logic sequence
Timing Diagrams
Interaction Overview Diagrams
![Page 8: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/8.jpg)
Charles ANDRE - UNSA8
Sequence diagram (1)• A sequence diagram is an interaction diagram that
emphasizes the time ordering of messages.• The diagram shows:
– The objects participating in the interaction.– The sequence of messages exchanged.
Sequence Diagram
Sequence diagrams are particularly important to designers because they clarify the roles of objects in a flow and provide basic information for determining class responsibilities and interfaces.
![Page 9: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/9.jpg)
Charles ANDRE - UNSA9
Example: use CaseView Report Card
Student
Register for Courses
Login
Select Courses toTeach
Submit Grades
Professor
Registrar
Billing System
Maintain ProfessorInformation
Maintain StudentInformation
Close Registration
Course Catalog
![Page 10: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/10.jpg)
Charles ANDRE - UNSA10
Sequence diagram (2)• The SD below shows the object interactions to support
the Register for Courses’ use case, Create a Schedule sub-flow
![Page 11: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/11.jpg)
Charles ANDRE - UNSA11
Sequence diagram (3)• Elements of a sequence diagram
:Student
:RegisterForCourseForm
:RegistrationController
catalog:CourseCatalogSystem
:CourseCatalog1:create schedule( )
2:get course offerings( )
3:get course offerings(for semester)
4:get course offerings( )
5:display course offerings( )
6:display blank schedule( )
ref Select offerings
sd register for courses
roles
Life line
Reflexive message
Event occurrence
Execution occurrence
Interaction occurrence
message
Sequence diagram
Anonymous participant
Named participant
![Page 12: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/12.jpg)
Charles ANDRE - UNSA12
Combined fragments• Often there are times when a particular sequence of
event occurrences has special constraints or properties. For example, you may have a critical region within your interaction where a set of method calls must execute atomically, or a loop that iterates over a collection. UML calls these smaller pieces interaction fragments.
• Interaction fragment can be placed in a container called a combined fragment. Additional details can be added for each fragment, and you can specify how several fragments relate to each other.
• Each combined fragment is made up of an interaction operator and one or more interaction fragments, which are the interaction operands . An interaction operator specifies how the interaction operands should be interpreted.
![Page 13: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/13.jpg)
Charles ANDRE - UNSA13
Interaction operators• alt: (alternatives) n operands with guards
• opt: (option) executes only if the guard is true
• break: terminates the enclosing interaction
• par: (parallel) n operands, interleaving
• seq: (weak sequencing) operands can be interleaved
• strict: strict sequencing of the operands
• neg: (negative) represents traces that are defined to be invalid
• critical: (critical region) traces of the region cannot be interleaved by other OccurrenceSpecifications
• assertion: The sequences of the operand of the assertion are the only valid continuations.
• loop: The loop operand will be repeated a number of times. The Guard may include a lower and an upper number of iterations of the loop as well as a Boolean expression.
• (see UML superstructure, chapter Interactions for details)
![Page 14: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/14.jpg)
Charles ANDRE - UNSA14
Example of combined fragment usage
![Page 15: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/15.jpg)
Charles ANDRE - UNSA15
Message kinds
![Page 16: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/16.jpg)
Charles ANDRE - UNSA16
Communication diagram (1)• 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
![Page 17: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/17.jpg)
Charles ANDRE - UNSA17
Communication diagram (2)
:Student
:RegisterForCourseForm
:RegistrationController
catalog:CourseCatalogSystem
:CourseCatalog
1:create schedule
2:get offerings( )
3:get course offerings(for Semester)
4:get course offerings( )
sd register for courses
5:display course offerings( )6:display blank schedule( )
![Page 18: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/18.jpg)
Charles ANDRE - UNSA18
Communication diagram contents
:Student
:RegisterForCourseForm
:RegistrationController
catalog:CourseCatalogSystem
:CourseCatalog
1:create schedule
2:get offerings( )
3:get course offerings(for Semester)
4:get course offerings( )
sd register for courses
5:display course offerings( )6:display blank schedule( )
actor
links
object
message
![Page 19: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/19.jpg)
Charles ANDRE - UNSA19
Communication diagram• Messages with concurrency
![Page 20: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/20.jpg)
Charles ANDRE - UNSA20
Sequence and communication diagrams: 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
![Page 21: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/21.jpg)
Charles ANDRE - UNSA21
Sequence and communication diagrams: Differences
– Show relationships in addition to interactions
– Better for visualizing patterns of communication
– Better for visualizing all of the effects on a given object
– Easier to use for brainstorming sessions
– Show the explicit sequence of messages
– Show execution occurrence
– Better for visualizing overall flow
– Better for real-time specifications and for complex scenarios
Communication diagrams
Sequence diagrams
![Page 22: UML Interactions - Sophia · 2007-12-04 · system can be described as interactions and compared ... Diagram – High level view of interaction sets combined into logic sequence Timing](https://reader034.fdocuments.us/reader034/viewer/2022042203/5ea3a11ec92f5945161e2db2/html5/thumbnails/22.jpg)
Charles ANDRE - UNSA22
Timing diagram
:Mai
lSer
ver