4 ~ Maîtriser le couplage et la cohésion

💡 En un mot

Un bon design vise un couplage faible et une cohésion forte.

🎯 Ce que cela garantit ✅

🎯 Ce que cela n'est pas ❌


❌ Mauvais (couplage fort)

class PaymentService {
  constructor() {
    this.gateway = new StripeGateway();
  }
}

✅ Bon (couplage faible)

class PaymentService {
  constructor(gateway) {
    this.gateway = gateway;
  }
}

👉 Pourquoi ?


Révision #4
Créé 2026-02-13 12:36:29 CET par Larananas
Mis à jour 2026-02-13 13:05:48 CET par Larananas