High Cohesion and low coupling

Source: Internet
Author: User
Module independence means that each module only performs the independent sub-functions required by the system, and has the least contact with other modules and simple interfaces. There are two qualitative measurement standards: coupling and cohesion.
Coupling is also called inter-block connection. Refers Software A measure of the closeness of modules in the system structure. The closer the relationship between modules, the stronger the coupling, and the poorer the module independence. The coupling between modules depends on the complexity of Inter-module interfaces, the call methods, and the information transmitted.
No direct coupling; Data coupling; tag coupling; control coupling; Public coupling;
Content coupling (low-high); 1 no direct coupling; 2 Data coupling refers to the call relationship between two modules, passing simple data values, which is equivalent to passing values in advanced languages; 3 tag coupling refers to the data structure transmitted between two modules, such as the array name, Record Name, and file name in the advanced language. In fact, the data structure address is passed; 4. control coupling refers to the transfer of control variables (such as switches and labels) when one module calls another module ), the called module selectively executes a function in the block through the value of the control variable .; 5. Public coupling refers to the coupling between modules that interact with each other through a public data environment. Complexity of Public Coupling Program The number of Coupled modules increases. 6. Content coupling: this is the highest degree of coupling and the worst coupling.
When one module directly uses the internal data of another module, or transfers the data to another module through an abnormal portal. Cohesion is also called intra-block contact. A measurement of the module's functional strength, that is, a measurement of the closeness of each element in a module. If the elements in a module (between language names and between program segments) are closely related, the higher the cohesion.
Accidental cohesion; logical cohesion; time cohesion; Communication cohesion; sequential cohesion;
Function cohesion (low-high) 1 accidental cohesion refers to the absence of any connection between each processing element in a module. 2. Logical cohesion refers to the execution of several logical functions in the module, and the parameter is used to determine which function the module performs. 3. Time cohesion: Combine the actions to be executed at the same time to form a time cohesion module. 4. Communication cohesion means that all processing elements in the module operate on the same data structure (sometimes called Information cohesion), or that each processing process uses the same input data or generates the same output data. 5. Ordered cohesion means that each processing element in a module is closely related to the same function and must be executed sequentially. The output of the former function element is the input of the next function element. 6. Function cohesion: This is the strongest cohesion. It means that all elements in the module work together to complete a function. Coupling with other modules is the weakest. Coupling and cohesion are two qualitative criteria for module independence. When dividing software systems into modules, we try our best to achieve high cohesion and low coupling to improve the module independence. Design High-quality software architecture lays the foundation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.