CS FundamentalsHardProduct-company design interview

A team applies the Open/Closed principle so aggressively that every class has an interface, a factory and plug-in points 'in case' requirements change, though most never do. Which principle warns against this?

  1. A. DRY
  2. B. Law of Demeter
  3. C. YAGNI (You Aren't Gonna Need It): build abstractions when a real need appears, because speculative generality adds cost and complexity now
  4. D. Liskov Substitution

Correct answer: C. YAGNI (You Aren't Gonna Need It): build abstractions when a real need appears, because speculative generality adds cost and complexity now

Abstractions have a carrying cost. YAGNI and 'speculative generality' (a code smell) say to add extension points when a second real case appears, not in anticipation.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic