What is the difference between coupling and cohesion?medium
Answer
Coupling measures how dependent one module is on another. Cohesion measures how closely related the responsibilities inside a single module are. Aim for low coupling and high cohesion.
Explanation
High coupling means changes in one module ripple into many others. Low cohesion means a module handles unrelated concerns, violating SRP. A well-designed class does one thing well (high cohesion) and depends on others only through narrow interfaces (low coupling). These two properties together make systems easier to test, refactor, and extend.
Follow-upHow would you refactor a God class that has grown too large?