Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class A uses Class B

 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Simon Xu
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the OO, Patterns, UML and Refactoring forum where they like to talk about this type of thing...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic