본문 바로가기
공부/Object-Oriented Design

3.1 – Coupling and Cohesion

by 혼밥맨 2021. 9. 21.
반응형

3.1 – Coupling and Cohesion

Coupling

Coupling for a module captures the complexity of connecting the module to other modules.

 

Tightly Coupled

If your module is highly reliant on other modules, you would say this module is tightly coupled to others. 

 

Loosely Coupled

If your module finds it easy to connect to other modules, this module is loosely coupled to others.

 

 

Degree

 

Ease

 

Flexibility

 

Cohesion

 

High Cohesion

If your module performs one task and nothing else or has a clear purpose, your module has high cohesion.

 

Low Cohesion

If your module tries to encapsulate more than one purpose or has an unclear purpose, your module has low cohesion.

 

 

In general, there is a balance to be made between low coupling and high cohesion in your designs. For a complex system, the complexity can be distributed to between the modules or within the modules.

반응형

'공부 > Object-Oriented Design' 카테고리의 다른 글

3.3 – Information Hiding  (0) 2021.09.21
3.2 – Separation of Concerns  (0) 2021.09.21
2.6 – Generalization  (0) 2021.09.18
2.5 – Decomposition  (0) 2021.09.18
2.4 – Encapsulation  (0) 2021.09.18

댓글