Coupling (computer programming): Difference between revisions

Content deleted Content added
+paragraphs, -"However"
moved paragraph about cohesion upwards
Line 2:
 
In [[computer science]], '''coupling''' or '''dependency''' is the degree to which each program module relies on each other module.
 
Coupling is usually contrasted with [[cohesion]]. Low coupling often correlates with high cohesion, and vice versa. The software quality metrics of coupling and cohesion were invented by Larry Constantine, original developer of Structured Design.
 
Coupling can be "high" (or "tight"), or "low" (or "loose"). Low coupling means that one module does not have to be concerned with the internal implementation of another module, and interacts with another module with a stable interface (see [[Information hiding]]). With low coupling, a change in one module will not require a change in the implementation of another module. Low coupling is a sign of a well structured [[computer system]].
Line 18 ⟶ 20:
* ''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 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. The software quality metrics of coupling and cohesion were invented by Larry Constantine, original developer of Structured Design.
 
Dependency is also common in talking about [[software package]] management. One software package, in order to work or to be fully functional, may depend on other software packages and thus must also be installed, and their specific versions must be known if [[backward compatibility]] is broken between versions. The [[Apt]] package format, as well as some versions of the [[RPM Package Manager|RPM]] package format, include dependency information between packages. This is convenient for updating software but can lead to [[dependency hell]].