intermediateDesign Patterns66 of 66

Explain the DRY principle.

Tests whether you frame DRY as 'every piece of knowledge should have a single authoritative representation,' not merely 'don't copy-paste code' -- duplicated logic (even if phrased differently) is the real violation, since both copies must now be kept in sync by hand.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Design Patterns & LLD questions