Katana VentraIP

Coupling (computer programming)

In software engineering, coupling is the degree of interdependence between software modules; a measure of how closely connected two routines or modules are;[1] the strength of the relationships between modules.[2]

Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa. Low coupling is often thought to be a sign of a well-structured computer system and a good design, and when combined with high cohesion, supports the general goals of high readability and maintainability.

History[edit]

The software quality metrics of coupling and cohesion were invented by Larry Constantine in the late 1960s as part of a structured design, based on characteristics of “good” programming practices that reduced maintenance and modification costs. Structured design, including cohesion and coupling, were published in the article Stevens, Myers & Constantine (1974)[3] and the book Yourdon & Constantine (1979),[4] and the latter subsequently became standard terms.

A has an attribute that refers to (is of type) B.

A calls on services of an object B.

A has a method that references B (via return type or parameter).

A is a subclass of (or implements) class B.

One approach to decreasing coupling is functional design, which seeks to limit the responsibilities of modules along functionality. Coupling increases between two classes A and B if:


Low coupling refers to a relationship in which one module interacts with another module through a simple and stable interface and does not need to be concerned with the other module's internal implementation (see Information Hiding).


Systems such as CORBA or COM allow objects to communicate with each other without having to know anything about the other object's implementation. Both of these systems even allow for objects to communicate with objects written in other languages.

Coupling versus cohesion[edit]

Coupling and cohesion are terms which occur together very frequently. Coupling refers to the interdependencies between modules, while cohesion describes how related the functions within a single module are. Low cohesion implies that a given module performs tasks which are not very related to each other and hence can create problems as the module becomes large.

di: number of input data parameters

ci: number of input control parameters

do: number of output data parameters

co: number of output control parameters

Coupling in Software Engineering[7] describes a version of metrics associated with this concept.


For data and control flow coupling:


For global coupling:


For environmental coupling:





Coupling(C) makes the value larger the more coupled the module is. This number ranges from approximately 0.67 (low coupling) to 1.0 (highly coupled)


For example, if a module has only a single input and output data parameter





If a module has 5 input and output data parameters, an equal number of control parameters, and accesses 10 items of global data, with a fan-in of 3 and a fan-out of 4,


Cohesion (computer science)

Connascence (computer science)

Coupling (physics)

Dead code elimination

Dependency hell

Efferent coupling

Inversion of control

List of object-oriented programming terms

Loose coupling

Make (software)

Static code analysis

(1974). Reliable Software through Composite Design. New York: Mason and Lipscomb Publishers.

Myers, Glenford J.

Offutt, A. Jefferson; ; Kolte, Priyadarshan (March 1993). "A Software Metric System for Module Coupling". Journal of Systems and Software. 20 (3): 295–308. doi:10.1016/0164-1212(93)90072-6.

Harrold, Mary Jean

Page-Jones, Meilir (1980). The Practical Guide to Structured Systems Design. New York: Yourdon Press.  978-8-12031482-5.

ISBN

Standard Glossary of Software Engineering Terminology. New York: . 1990. ISBN 0-7381-0391-8. 610.12_1990.

IEEE

(PDF). 3.01. International Software Architecture Qualification Board e.V. (ISAQB). 2015-05-15 [2009]. Archived from the original (PDF) on 2017-03-29. Retrieved 2019-06-23. [1] Archived 2016-02-22 at the Wayback Machine

"Curriculum for Certified Professional for Software Architecture (CPSA) - Foundation Level"