🧲 Software Design Principles · Core Principles
High Cohesion
Related responsibilities belong together.
A module is easier to understand when its contents serve one purpose.
All invoice calculation rules live in the Billing module.
💡 Like a well-organized toolbox: all the screwdrivers in one tray, so you always know where to reach.
💡 Why it matters
When related code lives together, you can find it, understand it and change it in one place. Low cohesion scatters a single idea across the codebase, so every change becomes a hunt. High cohesion makes modules self-explanatory and pairs naturally with loose coupling to keep a system tidy.
🛠️ How to achieve it
⚠️ Signs of trouble
- •One feature's logic is scattered across many modules.
- •A module mixes several unrelated ideas.
- •You must jump between files to follow one simple change.
- •Catch-all files like Common or Misc keep growing.
🎯 Quick check
Score: 0/3Three questions to test the idea.
1. What does high cohesion mean for a module?
Answer: Its parts all serve one clear purpose
A cohesive module groups related responsibilities so it is easy to find and understand.
2. Where should all invoice calculation rules live?
Answer: Together in the Billing module
Keeping related billing rules in one module makes them easy to find and change together.
3. What is a sign of low cohesion?
Answer: One feature's logic scattered across many modules
Scattered logic for a single idea is the classic symptom of low cohesion.
