A team of programmers is reviewing a proposed API for a new utility class. After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality. If they implement the new design, which two OO principles will they be promoting?

  1. Looser coupling

  2. Tighter coupling

  3. Lower cohesion

  4. Higher cohesion


Correct Option: A

AI Explanation

To answer this question, you need to understand object-oriented (OO) principles and how they relate to software design.

Option A) Looser coupling - This option is correct because reducing the number of methods in an API can help promote looser coupling. Coupling refers to the degree of interdependency between classes or components in a system. By reducing the number of methods, the programmers are likely reducing the dependencies between classes, making them more independent and loosely coupled.

Option B) Tighter coupling - This option is incorrect because reducing the number of methods in an API does not promote tighter coupling. Tight coupling refers to a high degree of interdependency between classes or components. In this case, the programmers are trying to reduce the dependencies and promote loose coupling.

Option C) Lower cohesion - This option is incorrect because reducing the number of methods in an API does not promote lower cohesion. Cohesion refers to the degree to which the responsibilities of a class or component are related and focused. Reducing the number of methods may or may not affect the cohesion of the API, depending on the specific design changes made.

Option D) Higher cohesion - This option is incorrect because reducing the number of methods in an API does not promote higher cohesion. Similar to option C, cohesion refers to the degree of relatedness and focus in the responsibilities of a class or component. The impact on cohesion depends on the specific design changes made.

The correct answer is A) Looser coupling. By reducing the number of methods in the API, the programmers are promoting looser coupling between classes or components.

Find more quizzes: