A checkout policy names only a payment interface defined around its needs. Each provider adapter implements that interface and names its own provider library. The policy can receive a new adapter through configuration without source edits. The interface contains only operations the policy uses. Which statements are supported by these facts? Select all that apply.
Matching the interface proves that each adapter preserves all promised payment behavior.
Using only needed operations proves that every future checkout change avoids policy edits.
The dependency direction supports dependency inversion between policy and provider details.
Adding a provider adapter is an extension the policy can accommodate without source edits.
Unlock full course notes by signing up
Including the Cost of Extension
For a planned notification-channel addition, the current design requires edits to six existing modules at 18 minutes per module. A proposed design requires edits to two existing modules at 12 minutes per module and a new channel implementation taking 42 minutes. Assume these additive estimates include all work for this change. What is the percentage reduction in estimated effort relative to the current design? Answer as a percentage, to one decimal place.
Inverting a Dependency One Safe Step at a Time
A ReportScheduler class creates a concrete MySqlReportStore inside its own code, so the scheduler cannot be unit-tested without a running database. You decide to apply the Dependency Inversion Principle. Your team requires that the program still compiles and every existing test still passes after each individual step. Arrange the steps in the order that satisfies this constraint.
Separating Editing from Recompilation
A system contains eight read-only client modules, three write-only client modules, two audit-only client modules and four adapter modules. These groups are disjoint. Compare two designs for a required change to an audit method's parameter type.
In the broad design, every listed module directly names one interface containing read, write and audit methods. In the segregated design, each client names only its corresponding focused interface, while every adapter implements all three focused interfaces.
In both designs, the audit change requires source edits to every adapter and every audit-only client. Read-only and write-only clients need no source edits. For this comparison, the build recompiles every listed module that directly names the changed interface and no other modules. Exclude interface-definition modules from all counts.
Finding a Dependency Against Stability
An online shop is split into modules. An arrow from one module to another means the first depends on the second, and each pair counts as one dependency. The dependencies are:
Checkout depends on Domain and Billing.
Admin depends on Domain and Billing.