This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Class A uses Class B 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 "Class A uses Class B" Watch "Class A uses Class B" New topic
Author

Class A uses Class B

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
Hi,
I got few answer from other forum. Hope this forum can help me on this.
There are several cases for "class A directly uses B". My question is there are any other cases besides the following cases? Thanks.
1) if class A refers to class B as a data member, local
variable, argument, data cast, or if A inherits from B or if
A implements interface B, then A uses B. Classes A and B
interact if either A uses B or B uses A.
2)A can directly refer class B's static methods (or data members). B does not have to be a data member or local variable or argument of A
3) instanceof B
4)Class.forName()
4)Inner class: if A is an inner class of B, then objects that are instances of A generally retain the ability to access the members of outer class B. In this case, B does not have to be the data member etc of A
5) Anonymous class
6) Conditional compilation
Thanks.
Simon
Doug Dunn
Author
Ranch Hand

Joined: Aug 03, 2003
Posts: 66
Simon,
It is not at all clear what you are asking here. Is this a "first active use" question? Perhaps it would help if you explained the problem you are trying to solve.


Download a copy of <a href="http://www.javarules.com" target="_blank" rel="nofollow"><i>"Mastering The Fundamentals of The Java Programming Language"</i></a>
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
In fact, we are doing reseach on change propagation on java program. For example, during maintenance, if we add one class or one method to the system, it might impact other parts. How do we find those impacted components at minimum effort. We need to do static analysis to find all the impacted components. That is why we are looking for all the cases that class A (or object A) uses class B (object B). Of course, we will iterately do that, thus we just need to see A directly using B.
Thanks.
Simon
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the OO, Patterns, UML and Refactoring forum where they like to talk about this type of thing...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class A uses Class B
 
Similar Threads
INNER CLASS AGAIN~~~! So terrible
class A uses class B
Inner classes and 'final'
class dependency
class dependence relation