Insoftware engineering,coupling is the degree of interdependence between softwaremodules, a measure of how closely connected two routines or modules are,[1] and the strength of the relationships between modules.[2] Coupling is not binary but multi-dimensional.[3]

Coupling is usually contrasted withcohesion.Low coupling often correlates with high cohesion, and vice versa. Low coupling is often thought to be a sign of a well-structuredcomputer system and a good design, and when combined with high cohesion, supports the general goals of highreadability andmaintainability.[citation needed]
Thesoftware quality metrics of coupling and cohesion were invented byLarry Constantine in the late 1960s as part of astructured design, based on characteristics of “good” programming practices that reduced maintenance and modification costs. Structured design, including cohesion and coupling, were published in the articleStevens, Myers & Constantine (1974)[4] and the bookYourdon & Constantine (1979),[5] and the latter subsequently became standard terms.
Coupling andcohesion 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.

Coupling can be "low" (also "loose" and "weak") or "high" (also "tight" and "strong"). Some types of coupling, in order of highest to lowest coupling, are as follows:
A module here refers to a subroutine of any kind, i.e. a set of one or more statements having a name and preferably its own set of variable names.
UserProfilecomponent. This component is designed to return the entire user profile information in response torequests, even whenconsumers only require a specificattribute. This practice exemplifies stamp coupling, which can lead to significantbandwidth issues, especially at scale. When any attribute within theUserProfile component changes, all consumers that interact with it may need to undergotesting, even if they do not utilize the modified attribute.[6]In recent work various other coupling concepts have been investigated and used as indicators for different modularization principles used in practice.[7]
The goal of defining and measuring this type of coupling is to provide a run-time evaluation of a software system. It has been argued that static coupling metrics lose precision when dealing with an intensive use of dynamic binding or inheritance.[8] In the attempt to solve this issue, dynamic coupling measures have been taken into account.
This kind of a coupling metric considers the conceptual similarities between software entities using, for example, comments and identifiers and relying on techniques such aslatent semantic indexing (LSI).
Logical coupling (or evolutionary coupling or change coupling) analysis exploits the release history of a software system to find change patterns among modules or classes: e.g., entities that are likely to be changed together or sequences of changes (a change in a class A is always followed by a change in a class B).
According to Gregor Hohpe, coupling is multi-dimensional:[3]
Tightly coupled systems tend to exhibit the following developmental characteristics, which are often seen as disadvantages:
Whether loosely or tightly coupled, a system's performance is often reduced by message and parameter creation, transmission, translation (e.g. marshaling) and message interpretation (which might be a reference to a string, array or data structure), which require less overhead than creating a complicated message such as aSOAP message. Longer messages require more CPU and memory to produce. To optimize runtime performance, message length must be minimized and message meaning must be maximized.
One approach to decreasing coupling isfunctional design, which seeks to limit the responsibilities of modules along functionality. Coupling increases between two classesA andB if:
A has an attribute that refers to (is of type)B.A calls on services of an objectB.A has a method that referencesB (via return type or parameter).A is a subclass of (or implements) classB.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 (seeInformation Hiding).
Systems such asCORBA orCOM 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 describes the degree and nature of dependency between software components, focusing on what they share (e.g., data, control flow, technology) and how tightly they are bound. It evaluates two key dimensions: strength, which measures how difficult it is to change the dependency, and scope (or visibility), which indicates how widely the dependency is exposed across modules or boundaries. Traditional coupling types typically include content coupling, common coupling, control coupling, stamp coupling, external coupling, and data coupling.[9][10][11]
Connascence, introduced by Meilir Page-Jones, provides a systematic framework for analyzing and measuring coupling dependencies. It evaluates dependencies based on three dimensions: strength, which measures the effort required to refactor or modify the dependency; locality, which considers how physically or logically close dependent components are in the codebase; and degree, which measures how many components are affected by the dependency. Connascence can be categorized into static (detectable at compile-time) and dynamic (detectable at runtime) forms. Static connascence refers to compile-time dependencies, such as method signatures, while dynamic connascence refers to runtime dependencies, which can manifest in forms like connascence of timing, values, or algorithm.[9][10][11]
Each coupling flavor can exhibit multiple types of connascence, a specific type, or, in rare cases, none at all, depending on how the dependency is implemented. Common types of connascence include connascence of name, type, position, and meaning. Certain coupling types naturally align with specific connascence types; for example, data coupling often involves connascence of name or type. However, not every combination of coupling and connascence is practically meaningful. Dependencies relying on parameter order in a method signature demonstrate connascence of position, which is fragile and difficult to refactor because reordering parameters breaks the interface. In contrast, connascence of name, which relies on field or parameter names, is generally more resilient to change. Connascence types themselves exhibit a natural hierarchy of strength, with connascence of name typically considered weaker than connascence of meaning.[9][10][11]
Dependencies spanning module boundaries or distributed systems typically have higher coordination costs, increasing the difficulty of refactoring and propagating changes across distant boundaries. Modern practices, such asdependency injection and interface-based programming, are often employed to reduce coupling strength and improve the maintainability of dependencies.[9][10][11]
While coupling identifies what is shared between components, connascence evaluates how those dependencies behave, how changes propagate, and how difficult they are to refactor. Strength, locality, and degree are interrelated; dependencies with high strength, wide scope, and spanning distant boundaries are significantly harder to refactor and maintain. Together, coupling provides a high-level overview of dependency relationships, while connascence offers a granular framework for analyzing dependency strength, locality, degree, and resilience to change, supporting the design of maintainable and robust systems.[9][10][11]
Coupling in Software Engineering[12] 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,
{{cite book}}: CS1 maint: location missing publisher (link)