Coupling วัดว่าโมดูลหนึ่งขึ้นอยู่กับอีกโมดูลหนึ่งมากเพียงใด Cohesion วัดว่าส่วนต่างๆ ภายใน โมดูลเชื่อมโยงกันอย่างแน่นแฟ้นเพียงใด เป้าหมาย: coupling ต่ำ cohesion สูง
สองแกน
text
HIGH cohesion → a class does ONE well-defined job, parts relate strongly ✅
LOW coupling → modules interact through small, stable interfaces ✅
Cohesion ต่ำ (แย่) กับ Cohesion สูง (ดี)
python
:
(): ...
(): ...
(): ...
: ...
: ...
: ...
