-1

I have this slide from my professor:

enter image description here

I don't understand why public class H and public class I are incorrect?

Is it because due to the lack of navigability shown (no arrows), you assume it's either 0 or greater than 0, so you MUST include them as an attribute field?

Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52
Aragon343
  • 23
  • 4
  • They are not incorrect, unless your professor and/or your book says that *unspecified navigability* should be navigable anyway. – Andreas Dec 13 '19 at 07:06
  • It’s not clear to me either, if the association had a name attached to it it might have give a clue of the relationship between H and I but now I don’t get it. – Joakim Danielson Dec 13 '19 at 07:17

1 Answers1

0

H and I have an association per UML but not per code.

p. 111 of UML 2.5:

<multiplicity-range> is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)

So you must implement it as single reference on both side. Without there will not be an association and that would be wrong.

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • So you are saying it is the same as F & G? – Joakim Danielson Dec 13 '19 at 08:45
  • @JoakimDanielson Two-way navigability can use no arrows or one at each end. – qwerty_so Dec 13 '19 at 09:31
  • Ok but I guess my problem here is how we can say something conclusive about this navigability and express it in code, which is what is expected here as I understand it. To me this just say there is a link between H and I but not what that link is. – Joakim Danielson Dec 13 '19 at 09:35
  • @JoakimDanielson See Fig. 11.29 on p 203 of UML 2.5 – qwerty_so Dec 13 '19 at 09:36
  • @JoakimDanielson Just read those pages around the referenced picture. It's quite clear that an association without adornment needs exactly one object reference on both ends. – qwerty_so Dec 13 '19 at 09:46
  • @JoakimDanielson Funny enough, I started this one: https://stackoverflow.com/questions/59320067/non-navigability-definition – qwerty_so Dec 13 '19 at 09:59