Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 © Wolfgang Pelz 2000-04UML2 UML Part Two. 2 © Wolfgang Pelz 2000-04UML2 Chapters Four & Twelve Interaction Diagrams.

Similar presentations


Presentation on theme: "1 © Wolfgang Pelz 2000-04UML2 UML Part Two. 2 © Wolfgang Pelz 2000-04UML2 Chapters Four & Twelve Interaction Diagrams."— Presentation transcript:

1 1 © Wolfgang Pelz 2000-04UML2 UML Part Two

2 2 © Wolfgang Pelz 2000-04UML2 Chapters Four & Twelve Interaction Diagrams

3 3 © Wolfgang Pelz 2000-04UML2 Interaction Diagrams models that describe how groups of objects interact (collaborate) class and use case diagrams are useful at capturing the structural nature of a system design in a generalized way interaction diagrams capture dynamic behavior applicable to timing or sequencing requirements

4 4 © Wolfgang Pelz 2000-04UML2 Use Case & Interaction Diagrams scenario - a specific instance of a use case, that is, a particular path through system functionality a single use case represents many related yet distinctly different scenarios typically, an interaction diagram captures the behavior of a single scenario Two forms of interactive diagrams: sequence and collaboration/communication

5 5 © Wolfgang Pelz 2000-04UML2 Sequence boxes at the top are participants (objects); vertical lines are time lines; horizontal directed lines are messages; unless specifically noted, only sequence (location on the time line) is important, not exact times an activation rectangle in the lifeline indicates a focus of control (activation) during which an object is performing an action, either directly or through another object

6 6 © Wolfgang Pelz 2000-04UML2 Notation (UML 1)

7 7 © Wolfgang Pelz 2000-04UML2 Sequence Diagram Example

8 8 © Wolfgang Pelz 2000-04UML2 Some Elaborations Usually objects have concurrent life spans so they are aligned at the diagram’s top. If an object is created, its lifeline starts with the receipt of a > message. Destruction can be explicitly noted with X. Sequence diagrams are good at visualization of how objects interact, but not good at showing details of algorithms, such as loops.

9 9 © Wolfgang Pelz 2000-04UML2 Another Sequence Example

10 10 © Wolfgang Pelz 2000-04UML2 Some More Elaborations Messages are function calls in traditional programming and events in event-driven programming. Messages may carry parameters. A dished line indicates a return, used to carry a return message or just indicate the end of a group of sub-actions. Self-call: sending messages to one self (message lines direct back to the same life line) Found messages: messages not originated from any participants. Synchronous messages: messages return only when done, block the flow of execution, no more messages from the same participant until a synchronous message is done. Asynchronous message: messages returns immediately, do not block the flow of execution. Guards are conditional expressions in square.

11 11 © Wolfgang Pelz 2000-04UML2 … and Another

12 12 © Wolfgang Pelz 2000-04UML2 alternatives in Sequence Diagrams

13 13 © Wolfgang Pelz 2000-04UML2 Time Constraints

14 14 © Wolfgang Pelz 2000-04UML2 Some More Elaborations Centralized control: one participants doing all the processing (traditional sequential programming). Distributed control: processing is split among many participants (OOP and event- driven).

15 15 © Wolfgang Pelz 2000-04UML2 Notations (UML 2) A participant was just an object in UML 1, but can be more than that (e.g. a group of objects) in UML 2. No more underline below the name in UML 2. : needs to be there with the class name in UML 2. aParticipant:Class :Class aParticipant

16 16 © Wolfgang Pelz 2000-04UML2 Interaction Frames New in UML2 Notations for loops, conditions and other detail algorithms. Common operators for Interactive Frames: alt (alternative), opt (optional), par (parallel), loop (loop), region (critical region), neg (negative), ref (reference), sd (sequence diagram).

17 17 © Wolfgang Pelz 2000-04UML2

18 18 © Wolfgang Pelz 2000-04UML2 Collaboration (UML 1.x) Communication (UML 2.x) –an interaction diagram that utilizes message numbering instead of a time line; emphasizes structural organization of objects that send and receive messages

19 19 © Wolfgang Pelz 2000-04UML2 Sequence Example (again)

20 20 © Wolfgang Pelz 2000-04UML2 Corresponding Collaboration Diagram

21 21 © Wolfgang Pelz 2000-04UML2 Which to Use? Choose sequence diagram when only the sequence of events needs to be shown and collaboration among the objects are priority. Choose a collaboration/communication diagram when the objects and their links facilitate understanding the interactions (you don’t have to put all objects at the top and make the lines all vertical or horizontal). Collaboration diagrams have relatively fixed notation and numbering scheme.

22 22 © Wolfgang Pelz 2000-04UML2 Links and Messages

23 23 © Wolfgang Pelz 2000-04UML2 Parameters and Return Values

24 24 © Wolfgang Pelz 2000-04UML2 Iteration and messages to “this”

25 25 © Wolfgang Pelz 2000-04UML2 Message Sequencing

26 26 © Wolfgang Pelz 2000-04UML2 Threads and Mutual Exclusion Letters in the numbering indicate different threads of control. Threads can be mutual exclusive if they are guarded by exclusive conditions.

27 27 © Wolfgang Pelz 2000-04UML2 Mutually Exclusive Paths

28 28 © Wolfgang Pelz 2000-04UML2 Sequence Diagram

29 29 © Wolfgang Pelz 2000-04UML2 Corresponding Collaboration Diagram

30 30 © Wolfgang Pelz 2000-04UML2 Another Collaboration Diagram

31 31 © Wolfgang Pelz 2000-04UML2 Exercise Draw the sequence diagram corresponding to the previous collaboration diagram

32 32 © Wolfgang Pelz 2000-04UML2 Making a Collaboration/Communication Diagram create a separate diagram for each system operation under development if the diagram doesn’t fit on an ordinary sheet of letter paper (A size), split into small diagrams Flat numbering (1,2,3..)is easy to keep track. Nested numbering (1.1.1.2.3.1, 1.1.1.2.2.4) can be confusing. use design by contract and use case descriptions to design a system of collaborating objects

33 33 © Wolfgang Pelz 2000-04UML2 Other Notations {tagged value} - in a class - a property either predefined or defined by the user to hold additional information about elements {constraint} - outside a class - applied to the role of the link active object - executes concurrently with its own thread of control


Download ppt "1 © Wolfgang Pelz 2000-04UML2 UML Part Two. 2 © Wolfgang Pelz 2000-04UML2 Chapters Four & Twelve Interaction Diagrams."

Similar presentations


Ads by Google