views:

191

answers:

3

What's the difference between Association and Dependency? Aren't they both the same thing? as if class A is associated with B then Class A is dependent on B ie. there's a dependency between A and B.

+1  A: 

Similar topic in SO: Does an association imply a dependency in UML?

In the above post, there's a reference to the UML's Superstructure document:
OMG Unified Modeling LanguageTM (OMG UML) Superstructure (PDF format)

Very technical but can be a good read as well.

o.k.w
I didn't know that before. Thanks +1
Adeel Ansari
A: 

Dependency relationship does not require direct communication between two elements. It just means that one object relies on a fact that another object exists.

Aleksei Potov
+1  A: 

When you are speaking in UML terms, an association allows one object to send a message to another object by instantiating it.A dependency, on the other hand, means that one objects relies on another object and it might change if the other object changes, however there are no instances of those to objects.

http://en.wikipedia.org/wiki/Dependency_(UML)

david