Skip to main content
InterviewHubPRO
Section Overview
Q39

Question 39 of 50

Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

78%
SOLID & OOP Principles (50 Qs)•Part 3: Enterprise Architecture, Package Design & Enforcement (25 - 35)

Interface Segregation Principle (ISP) vs Fat Interfaces.

senior LevelTypeScriptSystem Design

In Simple Words: "Clients should not be forced to depend upon interfaces that they do not use":

  • Fat Interface Anti-Pattern: An AllInOnePrinter interface declaring print(), scan(), fax(), and staple(). A basic office printer implementing this interface must implement empty stubs or throw UnsupportedOperationException for scanning and stapling!
  • Role Interfaces: Split into lean, granular capabilities:
    • Printer { print() }
    • Scanner { scan() }
    • FaxMachine { fax() }
  • Classes implement only the specific interfaces matching their true capabilities.