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?
- A. DRY
- B. Law of Demeter
- C. YAGNI (You Aren't Gonna Need It): build abstractions when a real need appears, because speculative generality adds cost and complexity now
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Two functions contain the same three lines of code, but one computes a GST rate and the other a delivery charge that happens to use the…
- A class Report depends on ReportFormatter, and ReportFormatter depends on Report to read its data, creating a cyclic dependency between…
- A unit test calls a service that reads the current time with datetime.now() and fails every day after 6 pm. What is the cleanest fix?
- How many of these situations can produce a merge conflict when merging branch B into A from their common ancestor O? 1. A and B changed…
- Feature X takes the 'happy path' through 5 screens. An alternate flow can occur at screen 2 (2 variants) and an exception flow at screen 4…
- A mobile app shows the error rate of a new release, rolled out to 10% of users as a canary, at 1.2% against 0.4% for the old version on…