Dependency in Class Diagrams
1 posts in topic
Flat View  Flat View

Posted By:   thats_Fine
Posted On:   Wednesday, October 27, 2004 08:55 AM


I have two classes Class1 and Class2.

An instance(object ) of Class1 has an instance(object) of Class2(i.e. aggregation).

There is a third class Class3, which uses an instance of Class1(dependency). Class3 also uses the instance of Class2 contained inside Class1 instance.

Now my question is: When I draw a class diagram, should I show only one dependency (i.e. Class3 dependson Class1) or 2 dependencies(Class1-Class3 and Class2-Class3)?
Please guide me.


Re: Dependency in Class Diagrams

Posted By:   Amir_Pashazadeh  
Posted On:   Wednesday, October 27, 2004 02:12 PM


I think you should draw Class3-Class2 dependency to, because:

  • Class1 may have association (or aggregation) with other objects that Class3 doesn't know anything about them, you must distinguish them somehow

  • Changes to Class2 interface or implementation affects Class3, so there is a real dependency between them.

Amir Pashazadeh

About | Sitemap | Contact