This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a doubt on Multiplicity indicator, for example class "ClassRoom" and "Chair" has association relationship as depicted below (with multiplicity indicator)
[ClassRoom] ----------------------- 1..* [Chair]
<fig 1> please assume  as box and dashed line as solid line
I would read it as "ClassRoom has atleast one or more Chair" so the multiplicity would be "one to many" between ClassRoom and Chair???.
what if I place "1" near to ClassRoom:
[ClassRoom] 1 ----------------------- * [Chair] <fig 2> Now should I read it as "ClassRoom has zero or more Chair" because "*" denotes "Zero or more instances" and multiplicity would be "zero to many" between ClassRoom and Chair. Do we need to always display multiplicity like figure 1? is figure 2 valid?
Can some one please clear my doubt? Thanks [ August 11, 2008: Message edited by: Vishal Gupta ]
I'm not sure if you have to place the one at the Classroom side. The fact that a Class is associated with AT LEAST one chair (1..*) one could assume that the chair would need a classroom in the diagram. I think what is more significant in this case, is if there is the existence of accessors / mutators (getters / setters) and any navigable relationship, this perhaps would verify more the definition of the multiplicity relationship.
However, saying that, if you were to put a one next to the classroom diagram, would this not suggest composition, and therefore would the line also require a solid diamond shape, as a chair would need one classroom? Destroy the classroom the chairs are then destroyed.
This is my understanding, hope it helps, of course anyone may correct me if I am wrong
be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Joined: Apr 01, 2008
Thanks Stephen.. I think I haven't stated the question correctly. I would like to know that is fig 2 valid way of showing multiciplity?. because (i think) mentioning 1..* on class "Chair" side is entirely different than 1------ * (i.e both on opposit side). And the relationship is 'asscociation' always. please let me know if it helps. [ August 13, 2008: Message edited by: Vishal Gupta ]