先决条件——耦合和内聚
凝聚:
内聚是模块内关系的指示。它是模块内的概念。内聚有多种类型,但通常高内聚对软件有好处。
耦合:
耦合也是模块之间关系的表示。它是模块间的概念。耦合也有很多类型,但通常低耦合对软件有好处。
现在我们将看到内聚和耦合之间的区别。内聚和耦合的区别如下:
Cohesion | Coupling |
---|---|
Cohesion is the concept of intra module. | Coupling is the concept of inter module. |
Cohesion represents the relationship within module. | Coupling represents the relationships between modules. |
Increasing in cohesion is good for software. | Increasing in coupling is avoided for software. |
Cohesion represents the functional strength of modules. | Coupling represents the independence among modules. |
Highly cohesive gives the best software. | Where as loosely coupling gives the best software. |
In cohesion, module focuses on the single thing. | In coupling, modules are connected to the other modules. |