High Cohesion & Low Coupling
The two GRASP principles that act as the scorecard for every design decision — how focused each class is, and how entangled the classes are with each other.
Two forces, always in tension
Most GRASP and SOLID advice ultimately serves two goals: keep each class focused (high cohesion) and keep classes from leaning on each other more than necessary (low coupling). They are not standalone patterns you apply on a specific step — they are the scorecard you hold up against every other decision. When Information Expert or the Single Responsibility Principle improves a design, it does so by raising cohesion, lowering coupling, or both.
Coupling: how entangled are the classes?
Coupling measures how much one class depends on the details of another. High coupling means a change ripples: edit one class and three others break or need re-testing.
// High coupling: OrderService reaches into a concrete database and its schema.
class OrderService {
save(order: Order) {
const db = new PostgresConnection("host=prod...");
db.execute(`INSERT INTO orders (id, total_cents) VALUES ('${order.id}', ${order.totalCents})`);
}
}OrderService now depends on Postgres, a connection string, and a table layout. Swapping the database, testing without one, or changing the schema all force edits here.
// Lower coupling: it depends on an abstraction it owns.
class OrderService {
constructor(private readonly orders: OrderRepository) {}
save(order: Order) {
this.orders.save(order);
}
}The service now depends only on a small interface. This is the same move the Dependency Inversion Principle formalizes, and it is why the two ideas are so often quoted together.
Cohesion: how focused is one class?
Cohesion measures how strongly a class's members belong together in service of one clear purpose. A highly cohesive class is easy to name and easy to describe without the word "and".
Low cohesion looks like a Utils or Manager class: unrelated methods sharing a home because there was nowhere else to put them. High cohesion looks like a Money class where every method is about arithmetic and formatting of amounts. This is the same target the Single Responsibility Principle aims at from a different angle — one reason to change usually means one cohesive purpose.
Why these are heuristics, not metrics
You cannot compute a single "correct" coupling score for a system, and chasing minimum coupling everywhere produces a fog of tiny interfaces that is its own kind of unmaintainable. These principles are directional guidance: when a design feels hard to change, ask which class knows too much about another (coupling) or which class is doing too many unrelated things (cohesion), and let the answer point at the refactoring. Treat them as questions, not thresholds.
Reach for it
- A change in one class keeps forcing edits in several others
- You cannot describe a class without listing unrelated jobs
- You are choosing between two designs and need a tie-breaker
Avoid it
- Splitting classes until trivial operations span five collaborators
- Adding an interface for every dependency regardless of variation
- Treating a coupling count as a target to minimize at all costs
Common mistakes
- Confusing few dependencies with low coupling. One dependency on a leaky abstraction (that exposes SQL, vendor types, or internal state) can couple you harder than five clean ones.
- Cohesion by size. A small class is not automatically cohesive, and a large one is not automatically not — count purposes, not lines.
- Optimizing one force in isolation. Design reviews that only ask "can we reduce coupling?" tend to shatter cohesion. Ask both.
Practice
Take a ReportManager that queries a database, formats HTML, emails the result, and logs the run. Score its cohesion (how many distinct purposes?) and its coupling (how many external details does it touch?). Split it into cohesive classes and note where you moved the coupling — did the total go down, or just relocate?