15

Image: Class B extends class A. Then Why is the arrow from B to A?

In the image above class B inherits class A. If B inherits all A's methods, shouldn't the arrow be from A to B? In my opinion it would make more sense if the arrow was from A to B.

Is there a reason that the direction of the arrow is this way and not the other way around? I would love to hear the explanation. Thank you.

EDIT: I know that this is the way that UML is designed, and that the diagram above is true according to the rules of UML, but my question is why UML made the arrow go this way .

Stephan Vierkant
  • 9,674
  • 8
  • 61
  • 97
user194878
  • 183
  • 1
  • 7
  • 2
    I voted to leave open; this isn't a matter of opinion, it's a matter of history. It was a matter of opinion until the decision was made and the standard published, back in the dawn of time. – arnt Apr 26 '18 at 12:18

2 Answers2

20

The reason is that in your case B references (or as you will calls out to) A. There is no knowledge about B in A, so no arrow from A to B, but rather the other way around.

The UML entity diagram is not about who 'gets' what, but rather about who references/knows about who.

Hiery Nomus
  • 17,429
  • 2
  • 41
  • 37
  • Thanks! I think I get it now. When I think about it, if you implement it in Java you would write "`class B extends A`" and not the other way around. `A` wouldn't be affected - it wouldn't "know" about it. – user194878 Apr 27 '18 at 10:53
  • 1
    very nice answer especially the part "There is no knowledge about `B` in `A`" – ChumboChappati Apr 28 '18 at 21:48
  • I think another way to look at this is using mathematical concept of *function* or *morphism*, or even generally speaking *mapping*. The relation of 1 to m, or 1 to 1 is necessary for the relation to be a *morphism*. In the type inheritance, there can be one or more than one sub-class for one super-class. So for the mapping to meet mathematical condition for a morphism, sub-classes must be the domain, where the mapping arrow starts―arrow tails are pointing. And the codomain(range) is super-classes. – Smart Humanism Dec 11 '22 at 18:13
0

Well, that's the way UML had been designed. The arrow points to the general class. The special one inherits and adds/replaces functionality.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • 1
    Thank you for your answer. But **why** are the arrows this way? What is the logic behind it? Is there a documentation about it or something I can read about? Thanks. – user194878 Apr 25 '18 at 19:33
  • 1
    Sure: https://www.omg.org/spec/UML/About-UML/ for the whole thing and https://www.uml-diagrams.org if you need some lighter digest. – qwerty_so Apr 25 '18 at 20:44