Design Patterns · Middle · Question 47 of 75

When should you extract an abstraction, according to the "rule of three"?

Explanation

Two cases are often similar by accident, while the third shows what's truly common. The rule helps balance DRY and YAGNI.

Further reading

Problem with a question

Design Patterns · Middle · question 47

Test yourself

Take the Design Patterns · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz