Question
Which SOLID principle emphasizes that a class should
have only one reason to change?Solution
The Single Responsibility Principle (SRP) in SOLID design principles states that a class should have only one reason to change, meaning it should encapsulate only one responsibility. This principle promotes cohesion and ensures that each class handles a single task or functionality. For instance, in an inventory management system, a Product class should handle product-related data only, while a separate Inventory class manages stock levels. Adhering to SRP reduces complexity, makes code easier to understand, and simplifies debugging and testing. By isolating responsibilities, developers can introduce changes without affecting unrelated parts of the system. Why Other Options Are Incorrect :
- Open/Closed Principle : Focuses on extending classes without modifying existing code, not on single responsibility.
- Liskov Substitution Principle : Ensures that derived classes can be substituted for their base classes without breaking functionality.
- Dependency Inversion Principle : Encourages dependency on abstractions rather than concrete implementations, unrelated to single responsibilities.
- Interface Segregation Principle : Suggests splitting large interfaces into smaller, specific ones, focusing on interface design, not class responsibilities.
The following Hindi sentences are followed by four different ways in which they can be paraphrased in English language. Identify the sentence ...
The aim of the study was to test the safety of the combination and the immune response after adding the pneumonia vaccine to the existing Covi...
MUSTER ROLL рдХрд╛ рдЕрд░реНрде рд╣реИ-
рджрд┐рдП рдЧрдП рдкреНрд░рддреНрдпреЗрдХ рдкреНрд░рд╢реНрди рдореЗрдВ рдПрдХ рд╣рд┐рдВрджреА рдХрд╛ рд╡рд╛рдХреНрдп рджрд┐рдпрд╛ рдЧрдпрд╛ я┐╜...
рдмреИрдВрдХ рд╢рдмреНрджрд╛рд╡рд▓реА┬а рдХреЗ рдЕрдиреБрд╕рд╛рд░ hard money рдХрд╛ рд╣рд┐рдВрджреА рдкрд░реНрдпрд╛рдп рд╣реЛрддрд╛ рд╣реИ ред
The operator is a green hand in this field.┬а
CARRIED DOWN рдХреЗ рд▓рд┐рдП рд╕рд╣реА рд╣рд┐рдиреНрджреА рдкрд╛рд░рд┐рднрд╛рд╖рд┐рдХ рд╢рдмреНрдж рд╣реИ -┬а
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд┬а рд╡рд┐рдХрд▓реНрдкреЛрдВ рдореЗрдВ рд╕реЗ Deficient рд╢рдмреНрдж рдХрд╛ рдкрд░реНрдпрд╛рдп рдирд╣реАрдВ рд╣я┐╜...
рджрд┐рдП рдЧрдП рд╢рдмреНрджреЛрдВ рдореЗ рд╕реЗ рдХреМрди рд╕рд╛ тАШрддрддреНрдкрд░рддрд╛ тАШ рд╢рдмреНрдж тАШ рдХрд╛ рд╕рд╣реА рдЕрдВрдЧреН...
рдЬрдорд╛рдирдд рдкреНрд░рддрд┐рднреВрддрд┐ рдЬрдорд╛ рдХреЗ рд▓рд┐рдП рд▓рд┐рдП рд╕рд╣реА рдкрд╛рд░рд┐рднрд╛рд╖рд┐рдХ рд╢рдмреНрдж рд╣реИ
...