It's not a secret anymore!*
The moose likes Product and Other Certifications and the fly likes Association and Dependency Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Association and Dependency" Watch "Association and Dependency" New topic
Author

Association and Dependency

T Rai
Greenhorn

Joined: Apr 16, 2002
Posts: 20
Hi All,
anyone knows the distiction between these two? when do we need these two? and importantly, how do we implement these two relationships in codes? any examples for the clarification?
I would appreciate your help. Thanks.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
You might post your question at:
http://www.coderanch.com/forums/f-9/patterns

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Lin Feng
Ranch Hand

Joined: Dec 11, 2002
Posts: 142
Association means two classes have relationship. For example Employees report to Manager , Students registered a Course etc... For example we
can have
class Employee
{
class Manager mDirectManager ;

}

Dependency means one class depends on another one. They do not have to be associated. The dependency can be a parameter type etc.

For example

Class AnyClass
{
public void anyMethod(Class AnyOtherClass b)
{
System.out.println(b.getName());
}

}

if the AnyOtherClass removed its getName() method , the AnyClass should be changed. Except in the anyMethod the AnyClass does not use AnyOtherClass.
This is an dependency.

Hope this help. You can find detail information about this from Apply UML and Patterns.

Thanks

Lin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Association and Dependency
 
Similar Threads
SSLHandshakeException: certificate expired
Equal immutable objects
Int
concurrent use of database
Button Click Event