Download presentation
Presentation is loading. Please wait.
Published byArchibald Knight Modified over 6 years ago
1
Software Design (SE321) Lect6-Collaboration Diagram
Ahmed Ben Haloum
2
Collaboration Diagram
Shows the relationship between objects and the order of messages passed between them. The objects are listed as rectangles and arrows indicate the messages being passed. The numbers next to the messages are called sequence numbers. They show the sequence of the messages as they are passed between the objects. Convey the same information as sequence diagrams, but focus on object roles instead of the time sequence.
3
That is mean, there is no “life line” in a collaboration diagram.
What are the differences between a sequence and a collaboration diagram ? Collaboration diagrams differ from sequence diagrams in that they capture ordered sequencing, but without including separate life lines like in sequence diagrams. sequence diagrams show time-based object interaction while collaboration diagrams show how objects associate with each other. That is mean, there is no “life line” in a collaboration diagram. :Object 1 Lifelines: Identify the existence of the object over time.
4
√ √ √ χ χ √ χ √ χ 2:Message2 1:Message1 4:Message4 3:Message3
object1 object2 object3 4:Message4 5:Message5 1:Message1 7:Message7 3:Message3 6:Message6 8:Message8 2:Message2 √ √ √ χ χ √ χ √ χ
5
Collaboration Diagram Notations
An Object Object: Class A Line to link between two objects (or an object and itself ) Arrows to show the action direction 1:Message Numbered messages to represent the required action Actor
6
Conditional Messages To indicate that a message is run conditionally, prefix the message sequence number with a conditional [guard] clause in brackets, for example [ x = true ]. This indicates that the message is sent only if the condition is met object1 object2 2:check(ID) 1:getdisplay(ID) 3:[ID is correct]display() An example to show using the conditional messages
7
Example: Collaboration diagram to show selling a product
5: get money 8: sale product() 1: order product 2:find(product) Customer salesclerk :Product 3:[Item is found]return(product details) 4:get price :Payment 9: get receipt 10: get product 7: return receipt() 6: make payment()
8
Another Example 2: check (name) 4:[not found]add patient()
: Patients 2: check (name) 3: return response 4:[not found]add patient() 9: add appointment 1: request appointment 7: check appointment() Patient receptionist :Appointment 10: get confirmation 8: available 6: No dues 5:[found] check dues() : Payments
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.