Reputation: 15787
Say I have a class structure like this:
public interface IFoo
{
}
public class Foo : IFoo
{
}
public class Bar
{
public void Test(IFoo foo)
}
Is it possible to show an association relationship between Foo
and Bar
(the weakest relationship). Should I even be doing this?
Upvotes: 1
Views: 3524
Reputation: 4350
As @Thomas Kilian said your relationship (between Bar
and IFoo
) is not any types of Association. It can be Dependency relationship.
To have more explaination about Dependency Relationship:
Dependency Relationship is one of UML relationships and it stand on top of other type dependencies.
Your dependency is type of Usage: use Dependency. (see reference 1)
For example, it could mean that some method(s) within a (client) class uses objects (e.g. parameters) of the another (supplier) class.
Unfortunately, Class Designer of Visual Studio, ONLY shows Inheritance and Association.
If we want to explain the idea:
Dependency Relationship did not show remarkable things between classes. There are many types of Dependencies (see reference 1 and reference 2) and if Class Designer wants to show each type of relationship, our diagrams will be so messy.
In the other hand, Dependency Relationship mostly use in Requirement and Analysis phase of Methodologies. (not mostly in implementation)
For this reason, if you reverse engineer your code to have Class Diagram of your code in CASE Tools (like Enterprise Architect), the dependency relationship will not draw by the CASE Tools.
Upvotes: 0
Reputation: 36295
You will show a dependency, which is the weakest form. And you draw it to the interface like this:
Upvotes: 2