1 / 28

Interaction Diagrams

Interaction Diagrams. Spring 2001. Introduction. Class diagrams are used to specify the static structure of a system Object diagrams are used to illustrate potential states of the system are typically used only for illustrative purposes

aweaver
Download Presentation

Interaction 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 Diagrams Spring 2001

  2. Introduction • Class diagrams • are used to specify the static structure of a system • Object diagrams • are used to illustrate potential states of the system • are typically used only for illustrative purposes • To specify an interaction, it must be stated which messages will be sent, in which order, and under which circumstances. • collaboration diagrams and sequence diagrams are referred to as interaction diagrams • two types of diagram provide alternative ways of expressing the same information

  3. Collaborations • Interactions are illustrated by adding messages to an object diagram • In order to achieve the required generality, interaction diagram in UML are based on the general notion of a collaboration, rather than on object diagrams. • A collaboration is a general description of the ways in which objects can be linked together in order to support the behavior to be supported. • Collaborations are related to class diagrams, as both of them specify ways in which objects can be linked together.

  4. Collaborations (cont’d) • Collaborations specify only those which are relevant to a particular type of interaction. • whereas class diagrams specify all the possible object structures in a system • Collaborations are defined not simply in terms of classes, but rather in terms of the roles that instances of those classes can play in various interactions

  5. Classifier Roles • Collaborations consists of roles • A role describes a particular way in which an object can participate in an interaction. • A classifier role describes a role that objects can play in interactions • Notation for a classifier role : the name of the role and its base class

  6. Association Roles • A collaboration consists of a number of classifier roles connected by association roles • It consists of three classifier roles, linked by two association roles • for finding the cost of a part in the stock control program

  7. Transient Links • An association between two classes implies that instances of the classes can be linked and messages sent between them. • Short lived links are known as transient links • situations in which objects are able to communicate • to distinguish transient links from links that are instances of associations.

  8. Transient Links • Parameter ‘part’ is used as the name of the corresponding classifier role, and the association role connecting to the assembly object is labeled with the appropriate stereotype to indicate that this link exists because of the parameter that was passed.

  9. Interaction Diagram • Sequence diagram • showing classifier roles only, but making the sequencing of messages very clear. • Collaboration diagram • showing classifier and association roles, and superimposing messages on association roles • The major difference between the two forms of diagram is the way they show the order in which message are sent.

  10. Sequence Diagrams • The classifier roles involved in the interaction are displayed at the top of the diagram • Each role has a dashed line, known as its lifeline • Activation : the period of time during which an object is processing a message designated as a narrow rectangle whose top is connected to a message.

  11. Collaboration Diagrams • Unlike sequence diagram, collaboration diagrams show association as well as classifier roles • messages sequencing cannot be shown graphically

  12. Collaboration Diagrams (cont’d) • Hierarchical numbering of messages • reflecting explicitly the structure of nested activations

  13. Object Creation • The relationship between orders and order lines is one of composition, because we assume that when an order is destroyed all lines of that order are also destroyed.

  14. Object Creation (cont’d) • Object creation on a sequence diagram

  15. Object Creation (cont’d) • Object creation on a collaboration diagram • In order to distinguish elements that are created during the course of an interaction from those which existed at the start, classifier and association roles corresponding to new objects and links are annotated with the property ‘new’.

  16. Object Destruction • Messages which cause the destruction of objects are labeled with the stereotype ‘destroy’.

  17. Object Destruction (cont’d) • Object deletion on a collaboration diagram

  18. Iterated Messages • Showing a collaboration which uses this notation to show that an assembly involved in an interaction can contain zero or more components. • Classifier roles and multiplicity

  19. Iterated Messages (cont’d) • In order to find out the cost of an assembly, a message must be sent to each of the components, no matter how many there are. • To emphasize the fact that a single symbol could correspond to multiple messages, notation is added to message label to indicate an iterated message send. • Iterated message passing on a collaboration diagram

  20. Iterated Messages (cont’d) • Iteration diagram passing on a collaboration diagram

  21. Multiobjects • An alternative way of showing multiplicity information associated with a classifier role is to use a multiobject. • a multipoint represents a collection of objects of the base type of the multiobject • Showing multiplicity with a multiobject

  22. Multiobjects (cont’d) • Showing an order object sending a message to a collection of order lines, asking for the line which corresponds to the catalogue entry with part number ‘n’.

  23. Multiobjects (cont’d) • Finding the total cost of an order

  24. Conditional Messages • A boolean expression written in square brackets

  25. Conditional Messages (cont’d) • Condition messages on collaboration diagrams

  26. Conditional Messages (cont’d) • Alternative messages on a sequence diagram

  27. Conditional Messages (cont’d) • Messages to Self

  28. Conditional Messages (cont’d) • Recursive activations are not shown so explicitly on collaboration diagram but, each recursive activation gives rise to an extra level of hierarchy in the numbering of subsequent messages

More Related