聯軸器選型
耦合 (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
聯軸器選型