Coupling: The tighter the connection between the modules , the stronger the coupling, and the worse the module independence. The coupling between modules depends on the complexity of the interface between modules, the mode of invocation and the information transmitted.
Coupling classification (Low----> High)
No direct coupling
Data coupling: Refers to a call relationship between two modules, passing a simple data value, equivalent to a high-level language value transfer;
Tag coupling: Refers to the two modules passed between the data structure, such as the high-level language of the array name, record name, file name and so on these names are marked, in fact, the address of this data structure is passed;
Control coupling: When a module calls another module, it passes a control variable (such as a switch, a flag, etc.), and the modulated module selectively executes a function within the block through the value of the control variable;
Public coupling: Refers to the coupling between those modules that interact through a common data environment. The complex program of public coupling increases with the number of coupling modules increasing;
Content coupling: This is the highest degree of coupling and also the worst coupling. When one module uses the internal data of another module directly or passes through an abnormal entrance to another module;
Cohesion: A measure of the degree to which each element within a module is bound to each other. The more cohesive the elements within a module (between the names and the program segments), the higher the cohesion is.
Classification of cohesion (low----> High)
Accidental cohesion: means that there is no connection between the processing elements within a module;
Logical cohesion: Refers to the module within the implementation of a number of logically similar functions, through the parameters to determine which function of the module to complete;
Time cohesion: The module that is formed by combining the actions that need to be executed together is a time-gathering module;
Communication cohesion: means that all processing elements within the module operate on the same data structure (sometimes referred to as information cohesion) or that each process uses the same input data or produces the same output data;
Sequential cohesion: Refers to a module in which each processing element is closely related to the same function and must be executed sequentially, the previous function element output is the input of the next functional element.
Function Cohesion: This is the strongest cohesion, refers to all the elements within the module together to complete a function, indispensable.
Eg: a program has 50 functions, the program executes very well, but once you modify one of the functions, the other 49 functions need to be modified, which is the consequence of high coupling.
Cohesion Poly-Low coupling