Concept · Core

Cohesion & Coupling

Aim for HIGH cohesion (a class’s parts belong together) and LOW coupling (classes barely depend on each other). It’s the master dial behind every other principle.

Asked atAmazonGoogleMeta
step 1 / 7
1/2Low cohesion, high coupling
Utils
+ parseDate()
+ sendEmail()
+ calcTax()
+ resizeImg()
Orders
Billing
Shipping
Low cohesion, high coupling
1class Utils { // grab-bag — does everything
2 parseDate(); sendEmail(); calcTax(); resizeImg();
3}
4 
5Orders → Billing → Shipping → Orders // tangled web
State
cohesionlow

Meet the Utils class: parseDate, sendEmail, calcTax, resizeImg. These methods have NOTHING to do with each other — a grab-bag. That’s LOW cohesion.