Question

    Which of the following is NOT one of the SOLID principles

    of software design?
    A Single Responsibility Principle Correct Answer Incorrect Answer
    B Open/Closed Principle Correct Answer Incorrect Answer
    C Interface Segregation Principle Correct Answer Incorrect Answer
    D Dependency Injection Principle Correct Answer Incorrect Answer
    E Liskov Substitution Principle Correct Answer Incorrect Answer

    Solution

    The SOLID principles are five core design principles in object-oriented programming that ensure software is modular, maintainable, and scalable. These principles are:

    1. Single Responsibility Principle (SRP): A class should have only one reason to change.
    2. Open/Closed Principle (OCP): Software entities should be open for extension but closed for modification.
    3. Liskov Substitution Principle (LSP): Subtypes must be substitutable for their base types.
    4. Interface Segregation Principle (ISP): Clients should not be forced to depend on interfaces they don’t use.
    5. Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules.
    While Dependency Injection is a programming concept that supports DIP, it is not explicitly a SOLID principle. Why Other Options Are Incorrect:
    • Single Responsibility Principle: Part of SOLID.
    • Open/Closed Principle: A core SOLID principle.
    • Interface Segregation Principle: Clearly defined in SOLID.
    • Liskov Substitution Principle: Integral to SOLID principles.

    Practice Next