1 / 33

Interaction and Communication Diagrams

Interaction and Communication Diagrams. Patrick Bailey Keith Vander Linden Calvin College. Interaction diagrams describe how groups of objects collaborate in some behavior. The UML defines several forms of interaction diagram, of which the most common is the sequence diagram.

kgoings
Download Presentation

Interaction and Communication Diagrams

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College

  2. Interaction diagrams describe how groups of objects collaborate in some behavior. The UML defines several forms of interaction diagram, of which the most common is the sequence diagram. Ref: Martin Fowler – UML Distilled, 3rd Edition

  3. Sequence Diagrams You should use sequence diagrams when you want to look at how several objects interact with each other within a single use case. Sequence diagrams are good at showing collaborations among the objects; they are not so good at precise definition of the behavior. Ref: Martin Fowler – UML Distilled, 3rd Edition

  4. Key Benefits Summarize • Analyze and design scenarios between objects. • Refine object definition and behavior. • Executable representation • Basis for test cases

  5. What’s in a name… z:Dishwasher :Dishwasher x: { Lifeline An instance of the class Dishwasher which is named z. Unspecified classifier. An anonymous instance of the class Dishwasher. For the first two, Rhapsody looks for an existing class OR asks if you are creating a new one.

  6. From Rhapsody’s Documentation The recipient of a message is either a class or a reactive class. Reactive classes have statecharts, whereas nonreactive classes do not. Reactive classes can receive events, triggered operations, and primitive operations.Non-reactive classes can receive only messages that are calls to primitive operations. Events are usually shown with slanted arrows to imply that they are asynchronous (delivery takes time). Triggered operations are shown with straight arrows to imply that they are synchronous (happen immediately).

  7. Messages A message represents an interaction between objects, or between an object and the environment. A message can be an event, a triggered operation, or a primitive operation. In the metamodel, a message defines a specific kind of communication. The communication could be raising a signal, invoking an operation, or creating or destroying an instance.

  8. Synchronous Message The UML standard uses a straight line with a solid arrow at the end to represent a synchronous message. The message is noted on the line along with the inputs to the message. startSystem(mode = 1)

  9. Return Message Return messages are represented by a dash line with an open arrow at the end. Return values can be expressed if needed. status_result

  10. Example of Centralized Control Execution Occurence Ref: Martin Fowler – UML Distilled, 3rd Edition

  11. Example of Distributed Control Ref: Martin Fowler – UML Distilled, 3rd Edition

  12. Creation and Deletion of Participants Ref: Martin Fowler – UML Distilled, 3rd Edition

  13. Slanted Messages (Asynchronous) In the UML standard, messages with an open arrowhead are asynchronous. Rhapsody adds to the standard. A message drawn on a slant is interpreted as an event if the target is a reactive class, and as a primitive operation if the target is a nonreactive class. A slanted message emphasizes that time passes between the sending and receiving of the message. Slanted messages can cross each other.

  14. Creating a Condition Mark Acondition mark (or state mark) is displayed on an instance line. A condition mark shows that the object has reached a certain condition or is in a certain state. Often, the name corresponds to a state name in the object's statechart.

  15. Creating a Timeout • The notation for timeouts is similar to the notation for events sent by an object to itself. There are two differences: • A timeout starts with a small box. • The name is a tm(x). • The label on a timeout arrow is a parameter specifying the length of the timeout. Timeouts are always messages-to-self.

  16. Creating a Canceled Timeout When designing a software system, you can establish waiting states, during which your program waits for something to occur. If the event occurs, the timeout is canceled. The sequence diagram shows this with a canceled timeout symbol. If it does not happen, the timeout wakes up the instance and resumes with some sort of error recovery process. Canceled timeouts are always messages-to-self.

  17. Common Operators for Interaction Frame Ref: Martin Fowler – UML Distilled, 3rd Edition

  18. Interaction Frames procedure dispatch foreach (lineitem) if (product.value > $10K) careful.dispatch else regular.dispatch end if end for if (needsConfirmation) messenger.confirm end procedure Ref: Martin Fowler – UML Distilled, 3rd Edition

  19. Use of Reference Referenced frame

  20. Frame Name Reference Example Continued

  21. Parallel Operation Example

  22. Rhapsody’s Implementation The Toolbar

  23. Communication Diagrams These emphasize the organizations of objects that participate in an interaction. Typically, it is vertically oriented, and unlike sequence diagrams they do not show the lifeline of an object nor do they show the focus of control.

  24. Example of Communication Diagram http://www.agilemodeling.com/artifacts/communicationDiagram.htm

  25. Which comes first – collaboration or class diagrams? • Generally, make an initial pass on classes • Collaboration diagrams may require you to re-evaluate your class design. • It is a cyclic, iterative process of understanding.

  26. Final thought • To model flows of control by timing order, the sequence diagram is more appropriate. • Communication diagrams are best when modeling flows of control by organization.

More Related