Content deleted Content added
TakuyaMurata (talk | contribs) coupling merged |
TakuyaMurata (talk | contribs) subclass coupling merged; add {{cleanup}} |
||
Line 1:
{{cleanup}}
In [[computer science]], '''dependency''' is a state where one object uses a functionality of another object. This may cause changes on implementation of one object can affect that of another object. Supposedly, [[Information hiding]] is a way to eliminate dependency to limit influence of changes and improve modularity. Dependencies can be reduced by applying the [[dependency inversion principle]]. Examples of dependency relationships are [[Aggregation (object-oriented programming)|aggregation]] (is-part-of), [[Inheritance (computer science)|inheritance]] (is-a), [[subtyping]], uses and implements relationships.
Line 15 ⟶ 17:
* ''Common coupling'' - Common coupling is when two modules share the same global data (e.g. a global variable).
* ''Content coupling'' - Content coupling is when one module modifies or relies on the internal workings of another module (e.g. accessing local data of another module).
* In [[object-oriented programming]], ''subclass coupling'' describes a special type of [[Coupling#Computer_programming|coupling]] between a parent [[class (computer science)|class]] and its child. The parent has no connection to the child class, so the connection is one way (i.e. the parent is a sensible class on its own). The coupling is hard to classify as low or high; it can depend on the situation.
Coupling is usually contrasted with [[cohesion]]. Low coupling often correlates with high cohesion, and vice versa.
[[Category:Object-oriented programming]]
{{Comp-sci-stub}}
|