What is high cohesion, low coupling?

Source: Internet
Author: User

What is high cohesion, low coupling? Cause: module independence means that each module accomplishes only the individual sub-functions required by the system, and has a minimum of contact with other modules and simple interfaces, two qualitative metrics-coupling and cohesion.
Coupling is also known as inter-block linkage. A measure of the degree of connection between modules in a software system structure. The tighter the connection between the modules, the stronger the coupling, the less the module's 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, tag coupling, control coupling, public coupling, content coupling, 1 no direct coupling: 2 data coupling: Two modules have a call relationship, pass a simple data value, equivalent to high-level language value transfer; 3 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, such as the name of the tag, in fact, the address of this data structure is passed, 4 control coupling: When a module calls another module, passing control variables (such as switches, flags, etc.), The modulated module selectively executes a function within a block through the value of the control variable; 5 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. 6 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 is also known as intra-block contact. A measure of the functional strength of a module, 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.
Cohesive Bandits (low-high): accidental cohesion, logical cohesion, time cohesion, communication cohesion, sequential cohesion, functional cohesion; 1 accidental cohesion: There is no connection between the processing elements within a module. 2 Logical Cohesion: The module performs several logically similar functions and determines which function the module accomplishes by parameters. 3 time to gather: combine the actions that need to be performed together to form a module that is a time-gathering module. 4 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. 5 Sequential Clustering: 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. 6 function Cohesion: This is the strongest cohesion, refers to all the elements within the module together to complete a function, indispensable.     Coupling to other modules is the weakest.     Coupling and cohesion are the two qualitative standards of module independence, when the software system is divided into modules, it is possible to achieve high cohesion and low coupling, improve the independence of modules, and lay the foundation for designing high quality software structure. One example is easy to understand: 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.
Once you understand it, the design class or module will naturally take into account "high cohesion, low coupling" When you write an outline design. Transfer from blogger: ROBNETCN

What is high cohesion, low coupling?

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.