Which SOLID principle encourages splitting large interfaces into smaller, specific ones?

Get ready for your Object‑Oriented Programming Test. Use flashcards and multiple-choice questions. Each question includes hints and explanations. Prepare for your exam today!

Multiple Choice

Which SOLID principle encourages splitting large interfaces into smaller, specific ones?

Explanation:
The main concept here is Interface Segregation Principle. This principle says that you shouldn’t force clients to depend on methods they don’t use, so it’s better to have several small, focused interfaces than one large, bloated one. In practice, you break broad capabilities into separate interfaces like Printable, Scannable, and Faxiable, so a class only implements what it actually supports and clients depend on the specific subset they need. That keeps code decoupled and easier to modify or extend. The other SOLID principles address different concerns: Single Responsibility focuses on a class having one reason to change; Open/Closed on extending behavior without modifying existing code; Dependency Inversion on depending on abstractions rather than concrete implementations. So the choice that matches splitting large interfaces into smaller, specific ones is the Interface Segregation Principle.

The main concept here is Interface Segregation Principle. This principle says that you shouldn’t force clients to depend on methods they don’t use, so it’s better to have several small, focused interfaces than one large, bloated one. In practice, you break broad capabilities into separate interfaces like Printable, Scannable, and Faxiable, so a class only implements what it actually supports and clients depend on the specific subset they need. That keeps code decoupled and easier to modify or extend. The other SOLID principles address different concerns: Single Responsibility focuses on a class having one reason to change; Open/Closed on extending behavior without modifying existing code; Dependency Inversion on depending on abstractions rather than concrete implementations. So the choice that matches splitting large interfaces into smaller, specific ones is the Interface Segregation Principle.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy