Coupling (software development)
Under coupling is understood in the computer science linking different systems, applications or software modules , as well as a measure describing the strength of this connection and the resulting dependency.
Coupling of systems and applications
Individual applications or systems can work together in different ways. The coupling describes how this happens. In general, one considers the flow of data from one application or system to another. A distinction is made here:
- Coupling through human intervention: This is not a coupling in the narrower sense, but must be included. Here, the information is transported between the two systems by a person.
- Coupling through formatted files: The data is transported between the applications using simple files (also called flat files ). All applications involved must understand the relevant format. The file formats used are often tab-separated, comma-separated or XML- based file formats.
- Coupling through converters : The problem that the various applications have to agree on a format for exchange is solved by converters. A converter converts one data format into another. He tries to maintain the semantics of the data. However, in many cases this is not entirely possible. There are many examples of converters in the free software field . For example, dvi2ps converts a DVI file into a PostScript file.
- Coupling via coupling procedures: When coupling via procedures, the client system calls a function on the server which is used to transfer the data. At the same time, it is possible to start a logic directly on the server side. In most cases, however, the source text of one or both applications must be adapted for the coupling via this method. In the different programming languages and concepts, there are different techniques to make this possible (keywords: RPC or RFC , CORBA , RMI , SOAP or Web Service , .NET Remoting , COM , DCOM ).
Coupling of modules
Different types of coupling are also considered within an application, namely the coupling between individual software modules. In contrast, the term bond (cohesion) describes the dependencies within modules. The aim for a system is as loose a coupling as possible and a strong bond.
Types of coupling
Different types of coupling can be distinguished, which can be classified according to their strength. The following rule applies: the lower the coupling, the more independent the module is.
Coupling types according to Myers
In 1974 Glenford J. Myers described the following coupling types:
- Content coupling : The module relies on the concrete implementation of the content of another module or modifies the internal data of the other. This very strong type of coupling should be avoided at all costs.
- Common coupling : Two modules communicate using common global data.
- External coupling: Two modules communicate via an externally specified mechanism; for example a specific file with a defined structure.
- Control coupling : One module influences the control flow of another; for example through a parameter that specifies the type of concrete action. A distinction must be made here as to whether the control parameter is a call parameter or a return value. The former is to be avoided, the latter sometimes cannot be changed. Thus the control coupling forms the boundary between the “good” weak and the “bad” strong couplings.
- Stamp coupling (data structure coupling): Two modules communicate via a complex data structure, only part of which is used.
- Data coupling: Two modules communicate via elementary data, for example simple parameters.
Originally, these types of coupling were disordered. It was only Meilir Page-Jones who introduced the above-mentioned order. He also defined another type of coupling: tramp coupling . This prevails when a module receives parameters, but does not use them itself, but only forwards them to other modules.
Coupling types according to IEEE
The Institute of Electrical and Electronics Engineers (IEEE) also defines various types of coupling, which, however, differ in detail from those of Myers. In the standard IEEE 610 , the Standard Glossary of Software Engineering Terminology , following coupling types are distinguished:
- pathological coupling: Corresponds to the content coupling in Myers' definition.
- content coupling : A module includes the content of another or parts of it.
- common-environment coupling (area coupling): as with Myers
- hybrid coupling : Here one parameter is both data and control flow information . For example, a parameter set to 0 could mean that the given information is unknown. Here it must first be found out which case is given, and only afterwards can the parameter be used. Hybrid couplings should be avoided.
- control coupling : as with Myers
- data coupling : as with Myers
Coupling types according to CPSA-F
According to the iSAQB Certified Professional for Software Architecture Foundation Level (CPSA-F) curriculum, the following coupling types are distinguished:
- about data types
- about hardware
- Glenford J. Myers: Reliable Software through Composite Design. Mason and Lipscomb Publishers, New York 1975.
- A. Jefferson Offutt, Mary Jean Harrold, Priyadarshan Kolte: A Software Metric System for Module Coupling. , The Journal of Systems and Software, 20 (3): 295-308, March 1993.
- Meilir Page-Jones: The Practical Guide to Structured Systems Design. YOURDON Press, New York 1980, ISBN 978-8120314825 .
- IEEE: Standard Glossary of Software Engineering Terminology. , 610.12_1990, New York 1990, ISBN 0-7381-0391-8 .
- Curriculum for Certified Professional for Software Architecture (CPSA) (PDF) International Software Architecture Qualification Board eV. May 15, 2015. Accessed June 23, 2019.