Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This post is about static dependency - for dynamic dependency and the difference, see Patrick Smacchia's answer.</p> <p>In an easy to understand way: an entity (class or package) A depends on an entity B when A cannot be used standalone without B.</p> <p>Inheritance, aggregation, composition, all of them introduces dependency between related entities.</p> <blockquote> <p>so there exists no dependency on an interface?</p> </blockquote> <p>there is, but interface only serves as the glue.</p> <blockquote> <p>what about inheritance?</p> </blockquote> <p>see above.</p> <blockquote> <p>so dependency is a transitive relationship not just on packages, but also on class level?</p> </blockquote> <p>yep.</p> <blockquote> <p>but how do you define "relies"?</p> </blockquote> <p>see above "easy to understand" definition. also related to the 3rd definition you posted.</p> <hr> <p>Update:</p> <p>So if you have interface A in Package P1, and class C in Package P2 uses A as </p> <ul> <li>method parameter, or </li> <li>local variable woven into C via AOP, or </li> <li><code>class C implements A</code>, or </li> <li><code>class C&lt;E extends A&gt;</code>, </li> </ul> <p>then C depends on A and P2 depends on P1.</p> <p>But if interface A is implemented by class B and class C programs against the interface A and only uses B via dependency injection, then C still (statically!) only depends on A, not on B, because the point of dependency injection is that it doesn't make glued components dependent. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload