Coupling (computer programming): Difference between revisions

Content deleted Content added
moving paragraph, -link:cohesion
intruducing sections
Line 7:
It must be noted that the specific term ''coupling'' is used in [[Object-oriented programming]] design along with its dual notion cohesion, while ''dependency'' is used in more traditional programming.
 
== High/low coupling ==
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]].
 
However, in order to achieve maximum efficiency, a highly coupled system is probably needed. In modern computing systems, performance can often be traded for lower coupling; the gains in the [[software development]] process are greater than the value of the running performance gain.
 
== Types of coupling ==
The types of coupling, in order of lowest to highest coupling, are as follows:
 
Line 21 ⟶ 23:
* 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.
 
== Known uses ==
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]].