420 likes | 579 Views
Chapter 15. UML Interaction Diagrams. Dynamic Object Modeling. Interaction diagrams: Sequence diagram Participants (objects) across the top Time proceeds down the diagram Communication diagram Objects can be placed anywhere (relative to each other) = compact
E N D
Chapter 15 UML Interaction Diagrams
Dynamic Object Modeling Interaction diagrams: • Sequence diagram • Participants (objects) across the top • Time proceeds down the diagram • Communication diagram • Objects can be placed anywhere (relative to each other) = compact • Sequence numbers indicate call-flow sequence (harder to read)
Mapping an Interaction Diagram to Code public class A { private B myB = new B(); public void doOne() { myB.doTwo(); myB.doThree(); } }
Code related to the Sale class public class Sale { private Payment payment; public void makePayment ( Money cashTendered) { payment = new Payment( cashTendered ); . . . } . . . }
Fig. 15.11 Object Destruction • Use only if you need to show the destruction of an object explicitly (e.g., C++)
Fig. 15.14 Simple UML 1.x style for conditional message • Not legal in UML 2, but still useful for sketching
Fig. 15.16 Iteration over a Collection • UML does not provide an official idiom for iteration • This suggested notation is relatively explicit.
Fig. 15.17 Iteration over a Collection • This alternative is more implicit.
Fig. 15.23 Link lines • Visibility between objects: an association • Navigation: path along which messages flow