Retour aux cas pratiques
SOLID PrinciplesFondamental

Segmentation d'une interface trop large (Interface Segregation Principle)

Scénario

Contexte Une interface Worker contient work() et eat(). Le Problème Un Robot implémente Worker mais n’utilise pas eat(). Code actuel class Robot implements Worker { work() {} eat() { throw Error("Not supported"); } } Contraintes Refactorer l’interface pour éviter l’implémentation inutile. Livrable attendu Une séparation d’interfaces respectant l’ISP.

Compétences ciblées

solidispooprefactoringclean-code
    Segmentation d'une interface trop large (Interface Segregation Principle) — mise en situation SOLID Principles | CodeDuel