Intermediate Web & Software Development
Q66 / 100

What is the main advantage of the repository pattern in a layered application?

Correct! Well done.

Incorrect.

The correct answer is D) It abstracts data-access logic behind an interface, so business logic does not depend on a specific persistence technology and can be tested with an in-memory fake

D

Correct Answer

It abstracts data-access logic behind an interface, so business logic does not depend on a specific persistence technology and can be tested with an in-memory fake

Explanation

A repository (e.g., OrderRepository) exposes methods like find() and save() while hiding whether data comes from MySQL, MongoDB, or an API. Swapping the underlying store or substituting a fake for tests does not require touching business logic.

Progress
66/100