Design Patterns · Middle · Question 47 of 75
When should you extract an abstraction, according to the "rule of three"?
- ✓Correct answer: When similar code shows up for the third time
- 2Right away, when writing the code for the first time, for the future
- 3Only after the project has existed for three years
Explanation
Two cases are often similar by accident, while the third shows what's truly common. The rule helps balance DRY and YAGNI.