Description
I came across a diagram that seemed to have too many arrows and too many kinds of arrows. The code is something like this:
class P:
pass
class A:
x: P
class B:
def __init__(self, x: P):
self.x = x
class C:
x: P
def __init__(self, x: P):
self.x = x
Classes A
, B
, and C
each have the same relationship to P
, namely that they each have a field of that type. So it seems to me that they should all look similar in the class diagram.
But instead, they look like this:
Class A
has a "composition" arrow (black diamond), class B
has an "aggregation" arrow (white diamond), and class C
has both.
Is this correct from a UML perspective? To me this output is unexpected and undesirable. I've tried reading about it, but everything I can find about "aggregation vs composition" turns into word soup and I can't make sense of it. Plus all the examples are from Java, with fine distinctions that don't seem to apply in Python. (This SO page is the best discussion I've been able to find.)
On top of all that, the x
field is unannotated in all of A
, B
, and C
, when it should say x: P
.
### Tasks
### Tasks
- [ ] Multiple arrows
- [ ] Aggregation vs composition arrows
- [ ] Missing field annotations