File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes dependency vs association again??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "dependency vs association again???" Watch "dependency vs association again???" New topic

dependency vs association again???

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
What difference would it make if I model a relationship as a dependency or as an association in my analysis/design class diagram?
Ex. What difference would it make to the understanding of the clients(ex teammembers) if I model the relationship between a professor and a whiteboard as dependency(writes on) when compared to modeling it as an association(writes on) in my analysis class diagram and my design class diagram?

Help me!Help you!!!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
In analysis I've hardly found a need for any line decoration atoll. Those little filled-in diamonds tend to poke through the napkin.
For design it gets to be important to know about "ownership". If you fire a professor, do all the whiteboards go away? If your diagram is your only mode of communication with someone, you maybe oughtta go for that kind of detail. But if you're standing around talking and something like professors and whiteboards is pretty obvious, skip it.
Dependencies are interesting all by themselves to see how well decoupled things are and to eliminate cycles in packages. These are things you're likely to see in the code more readily than a diagram. I just made a script to take output from JDepend (free from Clarkware) and make input for Dot (free from Graphviz) so Dot can draw package dependency pictures. My "review the picture, change the code, regenerate the picture" cycle is just seconds. Because Eclipse makes it so easy to refactor, this is not something I'd spend a lot of time designing before I start.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Wanna share the script with the rest of us, Stan?
I recently made a quick google for products that could visualize package dependencies and came out empty-handed.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Lasse Koskela:
I recently made a quick google for products that could visualize package dependencies and came out empty-handed.

Take a look at - it's quite cool!
And if you don't want to restrict your search to *free* tools, you didn't need to go a long way...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
That looks like a neat metrics package. We're about to start on customization of a vendor package, and it would be neat to track some of these over time. The export to XML ought to allow that.
Here's the little script, for what it's worth. It's in REXX
jQuery in Action, 2nd edition
subject: dependency vs association again???
Similar Threads
Dependency vs. association ?
dependency vs association
Association Vs Dependency
dependency or association??
Class Diagram -Association & Inheritance