Coding/Basic

[How to code] Coupling and Cohesion

이 글을 간단하게 번역한 글입니다.
  • Coupling: Software module 끼리 interdependence한 정도 (결합도).
    • High coupling: closely connected and changes in one module may affect other modules.
    • Low coupling: 각자의 모듈이 독립적이고 하나의 모듈에서의 수정이 다른 모듈에 영향을 미치지 않는다.
    • A good software design will have low coupling
  • Cohesion: 모듈에서의 element들이 연관된 정도 (응집도).
    • A good software design will have high cohesion. For example, 단일 책임을 가진 클래스, 다른 클래스에 바로 적용되는 클래스
    • (와닿지 않아서 예시가 필요해보인다.)