'What does dependency/dependant mean?
http://tutorials.jenkov.com/ood/understanding-dependencies.html#whatis says that (emphasis mine):
Whenever a class A uses another class or interface B, then A depends on B. A cannot carry out it's work without B, and A cannot be reused without also reusing B. In such a situation the class A is called the "dependant" and the class or interface B is called the "dependency". A dependant depends on its dependencies.
According to Google's definition:
a dependent or subordinate thing, especially a country or province controlled by another.
Since A depends on B, the dependency is A and the dependant is B. This is contrary to the first quote. Or am I missing something?
Solution 1:[1]
Terminology is context dependent. In general, the dependency is a synonym of dependence and describes not one entity, but state. According to Cambridge dictionary:
the situation in which you need something or someone all the time, especially in order to continue existing or operating.
So it's more about a relation to something. For example:
A minor child is dependent of his/her parents. The child is in a state of dependency. The dependency describes the relation between the child and its parents.
The google definition is only one of the available definitions (see for example the Collins dictionary), the one that is especially applicable in the context of geopolitics and real estate. For example:
Before 1776, America was a dependency of the British Empire. The dependency America was dependent on the Empire.
He bought a farm with several dependencies
The object oriented terminology is not so different from the more general definition: a dependency is a relationship between objects or classes. Here a more formal definition from the UML 2.5 standard:
7.7.1: A Dependency signifies a supplier/client relationship between model elements where the modification of a supplier may impact the client model elements.
So, restating what's in the tutorial, we can say that:
If A has to use B, A depends on B. There is a relation of dependency from A to B. A is said to be the dependent.
For practical reason and language convenience, B is often called the dependency (which is indeed the contrary of everyday's language). But in reality, it is still the relation of A to B that is the dependency.
Solution 2:[2]
The thing that is dependent on something is the dependency. I am dependent on H. I need H injected into me. H is a dependency of me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 |