All challenges
Multiple ChoiceBeginner 45s

Rule of three

What does the 'rule of three' suggest about when to abstract duplicated code?
Options
  1. 1Abstract the shared code on the very first occurrence to avoid any duplication at all costs
  2. 2Wait until the same pattern appears a third time before extracting an abstraction
  3. 3Never abstract duplicated code under any circumstances, tolerating unlimited copy-paste instead
  4. 4Only extract an abstraction when the duplicated code is identical character-for-character everywhere

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle