educative.io

Cricinfo Objects association quesion

Hi,

What is the relation between Team, Tournament Squad and Playing 11? Is it a one-way association?
Tournament Squad is a subset of Team and Playing 11 is a subset of Tournament squad. Is it not has a or is a relation here?

In this design, there are two different types of one-way association arrows used. Do they both talk about the one-way association (one is a plain arrow and other one is as shown in UML notation for association)
Match Played at Stadium
vs
Commentator makes Commentary

Thanks,
Surya

Hi @surya,

A good way to answer such questions is to try ‘saying’ the relationship and see if it seems valid. Let’s take an example of ‘TournamentSquad’ and ‘Playing11’. Do any of the following statement seems valid (take a moment and think about them):

  1. ‘Playing11’ is a ‘TournamentSquad’?
  2. ‘Playing11’ has a ‘TournamentSquad’?

or vice versa

  1. ‘TournamentSquad’ is a ‘Playing11’?
  2. ‘TournamentSquad’ has a ‘Playing11’?

As we know ‘is a’ means inheritance, so we can conclude that 1 and 3 can’t be true as ‘Playing11’ does not need to inherit all characteristics of ‘TournamentSquad’ and vice versa.

Next, ‘has a’ translates to ‘contains’, can we conclude that ‘TournamentSquad’ contains ‘Playing11’. It does not seem appropriate too, as we choose players from the ‘TournamentSquad’ to make ‘Playing11’ but we can’t say that ‘Playing11’ is some characteristic of ‘TournamentSquad’ and we should ‘contain’ it in ‘TournamentSquad’. Actually, ‘Playing11’ should be contained by a ‘Match’, which has two playing teams.

Hope this clarifies your question.

There is only one type of one-way association, we will fix the other arrow.