Software engineering _7th weeks

Source: Internet
Author: User

Cohesion and coupling (learning notes)

  First, the cohesion

Cohesion is a measure of the degree of correlation between components within a module. Put the cohesion in the order of tightness from low to High:

1, accidental cohesion: refers to a module within the components for the completion of a set of functions and together, they are mutually even if there is a relationship, is also very loose.

2, logic cohesion: A module to complete the task of the logical correlation

3, time to gather: A module contains the tasks must be executed within the same time period

4. Process cohesion: the processing components within the module are relevant, and these processes must be performed in a specific order.

5. Communication cohesion: All components of the module operate the same data set or generate the same data set.

6, the sequence of cohesion: the components of the module and the same function is closely related to the output of one component as the input of another component.

7. Function Cohesion: All components of the module are necessary to complete a single function.

  Second, the coupling

Coupling refers to a measure of two entities that depend on each other for each other. It is divided into the following categories:

1, non-direct coupling: There is no direct relationship between the two modules, the connection between them is completely through the Master module control and call to achieve

2. Data coupling: When one module accesses another, the input and output information is exchanged between each other through simple data parameters (not control parameters, public data structures, or external variables).

3, Tag coupling: A set of modules through the parameter table to pass the record information, is the tag coupling. This record is a sub-structure of a data structure, not a simple variable.

4, Control coupling: If a module through the transmission of switches, signs, names and other control information, obviously control the selection of another module function, is to control the coupling.

5, external coupling: A set of modules access the same global simple variable instead of the same global data structure, and is not passed through the parameter table information of the global variable, it is called external coupling.

6. Public coupling: If a set of modules accesses the same common data environment, the coupling between them is called public coupling. A public data environment can be a global structure, a shared communication area, a common area of memory, and so on.

7. Content coupling: Content coupling occurs between two modules if the following conditions occur

(1) One module directly accesses the internal data of another module;

(2) One module does not pass through the normal entrance to the inside of another module;

(3) Two modules have a part of the program code overlap (can only appear in assembly language);

(4) A module has a plurality of entrances.

  

  Coupling strength

The strength of the coupling depends on the following factors: (1) The Call of one module to another module, (2) The amount of data that one module passes to another module, and (3) How much control a module is applied to another module, and (4) The complexity of the interface between the modules.

    

Software engineering _7th weeks

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.