I want to draw a UML diagram of my program. Class
Barney has a method
Yabadaba(Doo d) which takes a parameter of type
How do I represent that class
Doo is used in class
Barney in my UML diagram?
Smells like a homework. Oh well.
I want to draw a UML diagram of my program.
What type of UML diagram? Class, sequence, collaboration? You need to learn to be precise and clear when asking questions.
With that said, I am going to assume you meant to ask for a class diagram (and my answer will be based off that assumption.)
Class Barney has a method Yabadaba(Doo d) which takes a parameter of type Doo.
How do I represent that class Doo is used in class Barney in my UML diagram?
You represent it by having a class artifact for Barney, in a class diagram, and with a method that takes the type (Doo) in question
If, the class Barney has a member field of type Doo, in addition to a method that takes an instance of Doo, then, you will have Barney with a Doo field on it.
Either that, or as an aggregation/association of some type. This example would show a composition of Barney with Doo.
What association/method you use to represent this, that depends on what you want to do. And for that, well, the solution is to read the manual. Hope it helps.
=== edit ===
btw, these images were created with the yuml.me online drawing tool.
At the very least, you want a dependency relationship from class
Barney to class
Barney maintains an instance of
Doo at some point in its life, then the relationship is stronger and becomes an association relationship:
The association relationship can be made even strong by adding a direction.
You can also consider multiplicity, which is the number of elements. This is most useful for if the element is optional or for composition/aggregation relationships. You may also decide that it may not be appropriate to include the
Doo class in your model, in which case you can simply indicate the method exists in