Reputation: 57
I want to make an UML diagram and show the dependencies between three classes: TransparentOverlayCamera
, ViewCameraView
and SubpartCameraPreview
.
TransparentOverlayCamera
has access to ViewCameraView
and the other way around. So I used a bidirectional association.
ViewCameraView
has access to SubpartCameraPreview
but not the other way around. So I used a unidirectional association.
But ViewCameraView
also passes an instance of TransparentOverlayCamera
to SubpartCameraView
, so that it has access to TransparentOverlayCamera
.
How do I model this last association in UML
correctly?
Upvotes: 1
Views: 375
Reputation: 2129
There is not necessary to use dependency relationship in your model. If you need to define structural relationship between classes , association is enough.
Be careful, association has no direction. Arrows at the association end represents navigability. Navigability defines that, instance at the association end is unambiguously identifiable. Association does not define communication as well.
If something is passed to instance, it is not a structural model but behavioral. You probably mean passing argument to operation. You need to define operation with arguments of specific type.
From you example: TransparentOverlayCamera will be set as argument type of operation defined on SubpartCameraView class.
Upvotes: 0
Reputation: 8145
You can draw the usage dependency link from SubpartCameraView
to TransparentOverlayCamera
If you want to avoid circles and keep your architecture layered then cross-layer dependencies are often modeled through <<interface>>
as in this example: http://www.uml-diagrams.org/design-pattern-abstract-factory-uml-class-diagram-example.html
See also: http://www.uml-diagrams.org/component-diagrams.html#provided-interface
Upvotes: 1