結合度(coupling) は、あるモジュールが別のモジュールにどれだけ依存しているかを表します。凝集度(cohesion) は、モジュール 内部 の各部分がどれだけ強く関連し合っているかを表します。目指すべきは 低結合・高凝集 です。
2つの軸
text
HIGH cohesion → a class does ONE well-defined job, parts relate strongly ✅
LOW coupling → modules interact through small, stable interfaces ✅
低凝集(悪い例)vs. 高凝集(良い例)
python
:
(): ...
(): ...
(): ...
: ...
: ...
: ...
