SOLID & OOP Principles (50 Qs)•Part 1: Core SOLID Principles & Fundamentals (1 - 10)
What is the Interface Segregation Principle (ISP)?
junior LevelTypeScript
In Simple Words: Many client-specific, granular interfaces are better than one bloated, "fat" interface:
- Violation: A monolithic
Workerinterface withwork(),eat(), andsleep(). ARobotclass implementingWorkeris forced to implement empty dummy methods foreat()andsleep(). - Refactoring: Split into
WorkableandFeedableinterfaces. Humans implement both; robots implement onlyWorkable.