Reputation: 23597
Does this make sense?
1) Car * -------(listeningTo)-------1 Radio Station
2) Car * -------(couldTuneInto)-----1 Radio Station
In creating a class diagram for my project, I am running in to problem with the above. I am under the impression that in general, the above must work both ways. So whenever you test if it makes sense, you check: "A car listening to 1 Radio Station". (Correct and makes sense). On the other hand, I would test it: "A radio station is listened by many cars." (does this make sense?)
Same goes for the second one.
My question is whether I set the multiplicity correctly and if it makes sense.
Thanks,
Upvotes: 0
Views: 1058
Reputation: 42276
I don't think your model makes a lot of sense, but before I explain details, let me present an alternative model that I think more accurately represents your domain:
"Car" [0..*] --- <listeningTo> --- [0..1] "Radio Station"
"Car" [0..*] --- <couldTuneInto> --- [0..*] "Radio Station"
Association #1 is pretty close to the same thing, the only real difference being that my representation doesn't necessitate that a car listens to a radio station (hence 0..1 instead of 1). It also might make sense to use a different verb in your relation because generally cars don't listen to radio stations (the people in them do). Also, the way that you've presented these two relations, it isn't clear exactly how "could tune into" and "listening to" are logically related. If you replaced "listening to" to with "is tuned into", then both:
Association #2 is different than your model. Your model seems to say that "many cars could tune into one and only one radio station". This doesn't really represent the real world, unless the domain you are modeling is in some very rural area with only one radio station. The "could tune into" relation has the semantics that indicate possibility, and generally it is possible for a car to tune into more than one radio station (hence the reason for those seek/scan buttons, preset stations, etc.) It is also possible for a car not to be able to tune into any radio stations (e.g. the the antenna is broken), so this also seems like it should be optional, and have a multiplicity of [0..*]
.
Upvotes: 3