The term coupling is used equally in electronic circuitry, transmission technology and software engineering.
In electronic circuitry, couplings provide for intentional and unintentional signal transfers between circuits or conductors. A coupling can be used to transfer DC or AC components from one circuit to another. Coupling can be part of the circuit design, but it can also couple interference from an interference source into an interference sink, i.e. couple interference signals from one circuit or conductor into another. In terms of coupling types, a general distinction is made between DC voltage couplings and AC voltage couplings.
DC coupling is a galvanic coupling in which circuits are conductively connected to each other. The DC voltage components can be coupled in a certain ratio. Voltage dividers or resistors are used for galvanic coupling, i.e. components that allow DC voltages to pass.
The situation is different with AC coupling, where only frequency-selected signal components are coupled, for example only higher or only lower frequencies. These types of coupling, which work with inductances and capacitances, are accordingly called inductive coupling or capacitive coupling. Inductive coupling is a magnetic coupling in which the alternating magnetic field of a coil or a current-carrying conductor induces a voltage in another coil or another conductor. The higher the current in the conductor, the greater the magnetic field and the induced voltage. This is also dependent on the distance between the two conductors, the smaller the distance, the higher the induced voltage.
It is different with capacitive coupling, which takes place via an electric field. In terms of circuitry, this coupling works with capacitors. In the case of unwanted interference coupling, capacitive coupling takes place between two conductors that are close to each other and is dependent on the potential difference between the two conductors, because this determines the electric field. In the case of inductive coupling, lower-frequency signals are preferred, i.e. also mains frequencies, whereas capacitive coupling prefers higher-frequency signals. The frequency component can be selected via RC or RL elements, via filters, transformers or resonant circuits.
A variant of coupling is feedback, where part of the signal is coupled into the same circuit from which it was taken. Depending on the phase position that is fed back, a distinction is made between positive and negative feedback.
In optical transmission, the coupling between the optical waveguides plays a decisive role, since faulty coupling causes high signal attenuation. Optical transmission technology is concerned with the reflection-free and low-attenuation coupling of light energy from the light source into the optical waveguide, and with the coupling of identical and different optical waveguides. For this purpose, there are various coupling methods such as lens coupling, oblique-ground coupling and face coupling, each of which offers application-specific advantages.
In software engineering, coupling describes the linking of software elements and modules and also defines a measure of their dependency. Software elements can be classes or packages, for example, so coupling always describes the interaction and dependency of parts of the software on each other. There are different types of coupling within a software. The goal of any software development should be to minimize coupling while maximizing cohesion - cohesion describes the cohesion of a module. Specifically, low coupling makes software easier to maintain and more stable overall. Like cohesion, data encapsulation and information hiding, coupling is a criterion for modularization
Content couplingMeans that one module can directly access the
data ofa second module
Again, the access of several modules to the same dataset, which in this case is global.
Control coupling. We speak of control coupling when a module controls a second module, for example, by explicitly passing a parameter
Data area coupling
A calling module passes its entire dataset to the called module, which only uses part of it
Here, multiple modules access the same dataset.In
comparison, the Institute of Electrical and Electronics Engineers (IEEE) goes a stepfurther and defines, among other things, several additional types of coupling as follows:
hybrid coupling. (hybrid coupling) The parameter passed by a first module to a second module simultaneously represents data and a function code to control the second module
(pathological coupling) This corresponds to the above-mentioned content coupling.
A module contains a second module in parts or completely. The
IEEE explains the common environment coupling, the control coupling and the data coupling in the same way as the first-mentioned definition.In
the context of coupling, one also speaks of tight (strong) and loose (weak) coupling
Static coupling is also possible, for example, by defining import interfaces. In contrast, dynamic coupling is determined by functions and procedures. If you arrange the first coupling types on a scale from one (= strong coupling) to five (= weak coupling), the weak coupling leads to the greatest possible independence of modules.
If one takes up here again the example of aspect-oriented programming, which was
introduced with the definition of cohesion, then the data coupling is advantageous for the interaction of modules and aspects
In principle, this corresponds to the data coupling between modules, but in connection with aspects it is controlled by the runtime system and not by a call of the aspect by a module, which is not important for a coupling from the point of view of the aspect. The other coupling types, on the other hand, increase the dependency on aspects and lead to them no longer being reusable.
Generally speaking, coupling can never be completely avoided in software
Control coupling alone leads to a higher flexibility and is therefore acceptable within limits. On the other hand, content coupling or even hybrid coupling should generally be avoided. Data coupling, for example, is often given by object orientation - even though this should be avoided. An example of decoupling would be getter and setter methods instead of direct access to attributes. Thus, structural coupling should also be avoided, which is present, for example, in the inheritance ofclasses across package boundaries. In conclusion, there are no explicit rules for avoiding coupling
.Also, no general metrics for the degree of coupling exist in this regard. Ultimately, low coupling is implemented through experience and appropriate implementation.