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?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
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
The Class Barney have not any relationship, but next class Barney you put enumeration class Doo with the Doo property.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?