Practice question · Select all that apply
The same block of validation logic has been copy-pasted into six files. Select every consequence the lesson attributes to this.
Hints
- The DRY principle is about the cost of CHANGE, not the cost of running.
- Two options describe consequences duplication does not actually have.
Show the answer
- B. A bug fixed in one copy remains in the other five
- C. The six copies will drift apart over time
- D. Any change to the rule must be made in six places
Why
Duplication multiplies the cost of every change, guarantees the copies eventually disagree, and lets a fix land in one place while the same bug survives elsewhere. It does not slow execution, each file still runs its own copy once, and it does not affect compilation. Reading DRY as a performance rule rather than a maintenance rule is the common misreading.
Practise Modular Decomposition and Reuse
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Modular Decomposition and Reuse
- Two modules each work perfectly and fail when combined. What kind of defect does that suggest, and why do…
- Match each modular-design term to what it describes.
- SavingsAccount extends Account and overrides applyMonthly(). A variable declared as Account is holding a…
- A date-handling module is being designed. Sort each item by whether it should be public or private.
- Order the steps of factoring duplicated logic into one reusable unit.