联轴器选型
耦合 (Coupling)
In general terms, the term coupling is defined as a thing that joins together two objects. If we talk about software development, then the term coupling is related to the connection between two modules, i.e. how tight interaction do the two modules hold with each other is defined by coupling.
一般而言,术语“ 耦合”定义为将两个对象连接在一起的事物。 如果我们谈论软件开发,那么术语耦合与两个模块之间的连接有关,即,通过耦合来定义两个模块之间保持的紧密交互程度。
Hence, the term coupling is defined as follows: "“The measure of the degree of the interdependency of two modules on each other is known as coupling."
因此,术语“ 耦合”定义如下: ““两个模块相互依赖程度的度量称为耦合”。
It should be noted that a module that has high cohesion and low coupling is functionally independent.
应该注意的是,具有高内聚性和低耦合性的模块在功能上是独立的。
How can the coupling between two modules be defined?
如何定义两个模块之间的耦合?
The interconnection of interdependency between two modules is defined by the interface between them because any two modules cannot be connected if there exists no interface between them. Now, the level of coupling that exists among the two modules is defined by the number of data transfers that take place among them. If any of the modules (or both) is highly dependent on the data that the other module provides to it, then we say that the two modules are highly coupled. Else, we say that the two modules are loosely coupled or the coupling between the modules is low.
两个模块之间的相互依赖关系的互连由它们之间的接口定义,因为如果两个模块之间不存在接口,则任何两个模块都无法连接。 现在,两个模块之间存在的耦合级别由它们之间发生的数据传输数量定义。 如果任何一个模块(或两个模块)高度依赖于另一个模块提供给它的数据,那么我们说这两个模块是高度耦合的。 否则,我们说两个模块是松散耦合的,或者模块之间的耦合很弱。
Now, the term coupling is further classified into different classes which help us to quantitatively determine the level of coupling between two modules. The different classes of coupling are as follows:
现在,术语耦合被进一步分为不同的类别,这有助于我们定量确定两个模块之间的耦合级别。 耦合的不同类别如下:
The sequence of the given classification is from high to low in a top-to-down manner. Now, let us define each of them to understand what they mean:
给定分类的顺序以从上到下的方式从高到低。 现在,让我们定义每个对象,以了解它们的含义:
Content Coupling: In the content coupling, the two modules are connected as they share the same content. What this means is that the content, i.e. the code of both the modules, has some parts in common which are the functions and methods that are used by both of the modules. This type of coupling is termed to be the strongest type of coupling.
内容耦合 :在内容耦合中,两个模块由于共享相同的内容而被连接。 这意味着内容(即两个模块的代码)具有某些共同点,这是两个模块所使用的功能和方法。 这种类型的耦合被称为最强的耦合类型。
Common Coupling: Two modules are said to be commonly coupled if they share the data using the same data items (i.e. the variables). These data items must be in global access to both of the modules so that both the modules can be able to access these data items.
通用耦合 :如果两个模块使用相同的数据项(即变量)共享数据,则称为通用耦合。 这些数据项必须对两个模块都具有全局访问权限,以便两个模块都能够访问这些数据项。
Control Coupling: If the data from the module is responsible for controlling the activities happening in another module, then these modules are said to be control coupled. Here, mostly, one or two bits of signal data are passed which controls the operations happening in some other module. A well-known example of this can be the set of flags of a module by some other module.
控制耦合 :如果来自模块的数据负责控制另一个模块中发生的活动,则可以说这些模块是控制耦合的。 在这里,大多数情况下,将传递一或两位信号数据,以控制其他模块中发生的操作。 众所周知的示例可以是某个其他模块对模块的标志集。
Stamp Coupling: Two modules are said to be stamp coupled if they both use a composite data item to interact with each other.
标记耦合 :如果两个模块都使用复合数据项相互交互,则称这两个模块为标记耦合。
Data Coupling: This type of coupling is the weakest one. Two modules are said to be data coupled if they communicate through some parameters. An example can be of the parameters that are passed to a function block.
数据耦合 :这种耦合是最弱的一种。 如果两个模块通过某些参数进行通信,则它们称为数据耦合。 一个示例可以是传递给功能块的参数。
翻译自: https://www.includehelp.com/basics/coupling-software-engineering.aspx
联轴器选型