How to model method parameters in class diagrams

Viewed 372

I have a project where class Foo has a member function which takes class FooParam as a parameter. Now I want to draw a UML class diagram representing the relationship between class Foo and FooParam.

From the options on the table, inheritance, implementation, aggregation and composition are automatically excluded. Thus, the options that are left are association and dependency, but to my eyes none of them fits quite right.

Given the options, how exactly do we model method parameters in class diagrams?

1 Answers

I agree with Gerd, you will not see a "link" or "relationship" between Foo and FooParam classes. I put below what you should see by default.

enter image description here

Of course, you can always add an explicit link (as a dependency for example) but it is, for me, duplication of the information...

enter image description here

The best is maybe to have a tool which would be able to compute this "link" or "relationship" and show it to you in some way.

Related