Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

What do you mean by a collaboration diagram ? Explain various terms and symbols used in a collaboration diagram. How polymorphism is described using a collaboration diagram ? Explain using an example. OR What is a collaboration diagram ? How polymorphism is represented in a collaboration diagram? Explain with an example.

Collaboration Diagram:

  • It’s a way to show how different parts of a software system interact or communicate.
  • Objects are represented as rectangles, actors (like users) initiate actions, links connect them, and messages show interactions.

Terms and Symbols:

  1. Objects:
    • Shown as rectangles with names inside (e.g., :FullTimeEmployee).
  1. Actors:
    • Users or entities initiating actions (e.g., MonthlyPayPrint).
  1. Links:
    • Solid lines connecting objects and actors (e.g., MonthlyPayPrint -----> :FullTimeEmployee).
  1. Messages:
    • Arrows with labels showing interactions (e.g., 2a:=calculatePay()).

Polymorphism Example:

  • Imagine a system calculating pay for different employees: Full-time, Part-time, and Temporary.
  • Each employee type has a different way of calculating pay.
  • Polymorphism allows using the same message (calculatePay()) for all employee types.
  • The collaboration diagram () shows MonthlyPayPrint asking each employee type to calculate pay using the same message.
  • MonthlyPayPrint doesn’t need to know the details of each employee type; it just knows they can all respond to calculatePay().

Leave a Comment