1 / 15

Sequence and Collaboration Diagrams

Sequence and Collaboration Diagrams. University of Sunderland. Purpose. Used to describe how subsystems and objects interact to produce the behavior of the system.

merlin
Download Presentation

Sequence and Collaboration 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. Sequence and Collaboration Diagrams University of Sunderland

  2. Purpose • Used to describe how subsystems and objects interact to produce the behavior of the system. • Provide complementary representations of the same information. You can convert from sequence diagrams to collaboration diagrams by considering the association roles. • Collaboration diagrams are the starting point for generating the object and class diagrams. • Collaboration diagrams are renamed communication diagrams in UML 2.

  3. Recommended Texts • Key text: Stevens and Pooley, 2000, Using UML, updated edition, Addison-Wesley, ISBN 0-201-64860-1. • Reference text: Alhir, 1998, UML in a Nutshell, O’Reilly, ISBN: 1-56592-448-7. (The basis for much of these lectures.) • Advanced text: Graham, 2001, Object-Oriented Methods, 3rd edition, Addison-Wesley, ISBN 0-201-61913-X. • Several articles are provided—explore them thoroughly in tutorial and at home!

  4. Sequence Diagram Notation • Sequence diagrams contain the following: • Class roles (subsystem/object/class, actor, and external system roles in the interaction). These are (usually) drawn across the top of the diagram. • Lifelines (subsystem/object/class existence). These (usually) extend down the diagram. • Activations (show when the subsystem/object/class is doing something) • Messages (communication between roles)

  5. Technique for Construction • Specify behavior • List class roles • Draw lifelines • Identify activations • Identify messages • Iterate

  6. Sample Sequence Diagram Role1 Role2 Role3 Role4 Class Role Activation Message Lifeline Recursive Activation

  7. Class Roles • Notation is a rectangle containing RoleName:ClassName (both underlined) • Can be an interface instead of class. • May have a number in the upper right hand corner giving the number of instances involved. • Represents an object, class, actor (person), subsystem or external system.

  8. Lifelines • Dashed or dotted line from past to future or from birth to death if a role with a limited lifespan. • Death is marked with a large • May split and merge to represent alternative paths. E.g.,

  9. Activation • Shown by a box over a lifeline • Represents an active role • May call itself recursively

  10. Messages • Denoted by labeled horizontal arrows • If simply an arrow, represents flow of control. • If shown as: represents a handshake (e.g., TCP). • If with a half-arrowhead, asynchronous (e.g., UDP): • If at an angle rather than horizontal, represents a time delay: } paired

  11. Collaboration Diagram Notation • Forms a context for interactions • May realize use cases • May be associated with operations • May describe the static structure of classes • Collaboration diagrams contain the following: • Class roles (subsystems/objects/classes/actors/ external systems) as before. • Association roles (pathways or links over which messages flow) • Message flows (messages sent between class roles)

  12. Technique for Construction • Specify behavior. • List class roles. • Identify association roles. • Define message flows • Iterate

  13. Sample Collaboration Diagram A Class Role An Anonymous Role RoleName: ClassName :ClassName A Message An Association Role :ClassName

  14. Association Roles • Often classes • Define the interaction between class roles. • Multiplicities defined if the Class Roles represent sets of objects Role-Name:Association-Name Multiplicity Multiplicity

  15. Message Flows • Sequence numbers on every message. These can be nested to associate related messages. • Arrows are the same as those used in sequence diagrams.

More Related