I did some reading on the <<instantiate>>
relationship in UML class diagrams. It's a dependency relationship where one side depends on the other.
However, I'm not sure who depends on who: does the instantiating class depend on the instantiated class, or is it the other way around? I found contradicting answers to this.
Let's call the instantiating class ClassA and the instantiated class ClassB.
On one hand, ClassA must have a new ClassB()
statement in it's code. Which means it has to 'know about' ClassB - a classic example when explaining what dependency is. So that means ClassA (the instantiating class) depends on ClassB.
However logically the existence of instances of ClassB might depend on an operation done by ClassA.
Which is correct: the instantiating class is said to depend on the instantiated class (meaning the dashed arrow will be pointing from the instantiating class to the instantiated class), or the instantiated class is said to depend on the instantiating class (so the arrow will be pointing the opposite direction)?