wood burning stoves*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Dependency vs Association Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Dependency vs Association" Watch "Dependency vs Association" New topic
Author

Dependency vs Association

Eric Lefurge
Greenhorn

Joined: Dec 05, 2001
Posts: 17
Folks
I am doing my partII assignment and having a tough time trying to distinguish if a relationship is either a dependency or association.
I know the definitions, any insights or rules of thumb that I can use from a practical perspective???
Eric
Victor Htet
Ranch Hand

Joined: Apr 09, 2000
Posts: 70
Eric,
Association is stronger than dependency. Association can be further specified as extends, implements, aggregation relationships.
From programming point of view, if you use class A as a paramater of a method or return type of a method in class B, then class B has dependency relationship with class A.
Victor
SCJP, SCWCD, SCEA


SCJP,SCWCD,SCEA,SCDJWS
Eric Lefurge
Greenhorn

Joined: Dec 05, 2001
Posts: 17
Victor
On the same note, say a class A instantiates Class B and calls its methods, then its an association ??

-@RIC
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
That could be stronger than association. It might
be aggregation or composition.
The experts disagree about what's what.
Victor Htet
Ranch Hand

Joined: Apr 09, 2000
Posts: 70
Eric,
Don't think too deep. I mean don't think at very detailed level. If you want to think in detail, do it with the following perspectives:
1) does class A hold class B as member variable?
2) does class A extends class B
3) does class A implements interface C
4) does class A's methods depend on class B or does changes to class B reflect class A behavior?

I highly suggest you design your system not in very detail level.
Eric Lefurge
Greenhorn

Joined: Dec 05, 2001
Posts: 17
Victor , Rufus
Thanks for ur suggestions.
One more clarification, So does it imply that relationships are implementation dependant and varies from each person who designed the application???
eRIC
Victor Htet
Ranch Hand

Joined: Apr 09, 2000
Posts: 70
Eric,
No. Your design should be as less implementation dependent as possible. But for assignment, you can stick to J2EE implementation perspective.
Yes. It varies from each person who designed the application??? Every design is unique for each architect.
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
In the strictest UML sense, I would not term 'extends' or 'implements' as association. They indicate relashionships between classes, but not association.
There are 4 types of relashionships - Association (Aggregation and Composition are stronger forms), Dependency, Generalization (extends) and realization (via implements or via delegation.)
For more on association and the stronger forms check threads:
http://www.coderanch.com/t/149591/java-Architect-SCEA/certification/UML-composition-vs-aggregation
http://www.coderanch.com/t/150298/java-Architect-SCEA/certification/Aggregation-Composition
HTH.


Sanjay Raghavan<br />SCJP2, SCEA-J2EE<br />Moderator - <a href="http://groups.yahoo.com/group/scea_prep" target="_blank" rel="nofollow">SCEA PREP</a><br />Co-Author - <a href="http://www.whizlabs.com/scea/scea.html" target="_blank" rel="nofollow">SCEA@Whiz</a><br /><i>Where did you sip your Java Today?</i>
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
A UML diagram is implemetatin dependent. UML
Modeling is like speaking a language. It's
a new language and different speakers do things
different ways.
Peter Coad gave an example of aggregation
as the relationship between an organization and
its clerks; Jim Rumbaugh stated that a company
is not an aggregation of its employees. When
gurus can't agree what are we to do?

from UML Distilled by Addison-Wesley
Eric Lefurge
Greenhorn

Joined: Dec 05, 2001
Posts: 17
Thanks for ur insight folks, if was very helpfull.
Now I feel like I am relationships expert, jus kidding.
eRIC
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dependency vs Association