Question
Which SOLID principle ensures that a class has only one
reason to change?Solution
The Single Responsibility Principle (SRP) states that a class should have only one reason to change, meaning it should have only one responsibility or function. This principle promotes cohesion by ensuring each class handles a specific part of the software functionality. For instance, a Customer class should handle customer data, while an Invoice class manages invoice generation. Adhering to SRP simplifies debugging, enhances maintainability, and prevents interdependent changes from cascading through the codebase. Why Other Options Are Incorrect :
- Open/Closed Principle : This emphasizes that classes should be open for extension but closed for modification, unrelated to SRP.
- Liskov Substitution Principle : This ensures that derived classes can replace base classes without altering program correctness.
- Dependency Inversion Principle : This recommends high-level modules should not depend on low-level modules but rather on abstractions.
- Interface Segregation Principle : This advises against forcing a class to implement interfaces it does not use, unrelated to SRP.
_____________ is the most critical factor in the maintenance of seed germination and viability of seed during storage.
The Central Rice Research Institute (CRRI) in India has been pivotal in rice research and development. Where is it headquartered?
Pekoe is related to the crop
Chemical formula of Gypsum is?
Single-humped Arabian Camel species found in India, are commonly known as -
Which state contributed the largest share of egg production in India during 2023-24?
How many ATP molecules can be derived from each molecule of acetyl CoA that enter the Krebs' cycle?
________is a practice of growing strip of crops having poor potential for erosion control (e.g. root crop, cereals) alternated with strips of crops havi...
The synthesis of ATP via electron flow through the ETS, with oxygen as the terminal electron acceptor, is known...
Which entomopathogens fungus role as biological control agent in cotton bollworm?