Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML: when one class have as method parameter pointer to other class

When one class have as method parameter pointer(or reference, or object) to other class, in UML it is reflected as association or aggregation, with diamond, or have some specific notation?

like image 469
Alecs Avatar asked Mar 23 '13 14:03

Alecs


1 Answers

As explained by other guys, you should use dependency and not any form of association (aggregation and composition).

A dependency means that the target element is required for the specification or implementation of the source element.

However, there are many different types of dependencies. The type of dependency can be specified by keywords and stereotypes. In your case you should use a dependency with keyword <<use>>:

enter image description here

To explain <<use>> I quote a part of the book UML 2 and The Unified Process from page 196:

This dependency (usage) is generated by any of the following cases:

1- An operation of class A needs a parameter of class B

2- An operation of class A returns a value of class B

3- An operation of class A uses an object of class B somewhere in its implementation but not as an attribute.

P.S: Other keywords/stereotypes a dependency can have are call, create, derive, instantiate, permit, realize, refine and trace.

like image 155
jurgenreza Avatar answered Oct 04 '22 12:10

jurgenreza