Questions
24 of 24
1What are the SOLID principles? Explain each briefly.
2Explain the Single Responsibility Principle (SRP) with an example.
3Explain the Open/Closed Principle (OCP). How do you achieve it without modifying existing code?
4Explain the Liskov Substitution Principle (LSP). What happens if it's violated? (Square/Rectangle problem)
5Explain the Interface Segregation Principle (ISP). Why are fat interfaces bad?
6Explain the Dependency Inversion Principle (DIP). How does it relate to Dependency Injection?
7What is the difference between Aggregation and Composition?
8What is the Factory Pattern? How does it help in achieving OCP?
9What is the Abstract Factory Pattern? How does it differ from Factory Method?
10What is the Strategy Pattern? How does it replace complex conditional logic?
11What is the Observer Pattern? Where is it used in real life? (Event handling, Pub/Sub)
12What is the Decorator Pattern? How does it add functionality dynamically?
13What is a Singleton Pattern? What are the thread-safety concerns and how to handle them?
14What is an Anti-Pattern? Can you name a few? (God Object, Spaghetti Code, Golden Hammer)
15What is "Coupling" and "Cohesion"? Explain the relationship between them.
16What are Generics/Templates? How do they improve type safety and performance compared to casting?
17What is Type Erasure (Java) vs Reified Generics (C#)?
18What is Variance in Generics? (Covariance and Contravariance)
19What are Extension Methods (C#) or Default Methods (Java)? When should you use them?
20What is Reflection? How can it be used to break Encapsulation? What are the performance costs?
21What is the "Law of Demeter"? (Don't talk to strangers)
22Explain "Tell, Don't Ask" principle.
23What is the DRY principle? How does OOP help achieve it?
24What is the YAGNI principle?
24 / 24

What is the YAGNI principle?

Difficulty: 5/10
code simplicity, feature scope, refactoring

YAGNI - You Aren't Gonna Need It

YAGNI means I should not implement functionality, abstractions or extension points until there is a real requirement for them. It helps prevent speculative complexity and keeps designs focused on current business needs. As a senior engineer, I balance YAGNI with architectural foresight: I do not build hypothetical features, but I still preserve sensible boundaries where the current requirements already justify them.

javascript
  1. 1

    Implement real requirements rather than speculative features.

  2. 2

    Avoid unnecessary abstractions and extension points.

  3. 3

    Reduces code, testing and maintenance cost.

  4. 4

    YAGNI does not mean ignoring known architectural requirements.

  5. 5

    Combine YAGNI with good boundaries so future change remains possible without building the future prematurely.

Scenario Questions

0-2 years experience

  1. 1You're adding a new method to a class to support a feature that might be added next quarter. How would you decide whether to implement it now?
  2. 2A teammate suggests creating a generic utility class for a one‑off calculation. What would you ask before writing it?
  3. 3During a code review you see a stubbed‑out feature flag for a future feature. What would you do with it?

2-5 years experience

  1. 1Your team is building a payment module and you notice a helper class being built for future reporting features. How would you evaluate if that's appropriate?
  2. 2A bug appears after you added extra validation that wasn't required for the current use case. Walk me through how YAGNI relates to that.
  3. 3When estimating effort, how do you balance YAGNI against potential future requirements?

5-8 years experience

  1. 1In a microservice architecture, a service team proposes adding a generic event bus to handle future events. How would you assess this decision using YAGNI?
  2. 2Your legacy codebase has many layers of abstraction that were added preemptively. How would you approach refactoring them while respecting YAGNI?
  3. 3During a performance incident, you discover that an over‑engineered caching layer is causing latency. Explain how YAGNI could have prevented this.

8+ years experience

  1. 1Your organization is planning a platform migration and wants to build a highly extensible framework now. How would you argue for or against a YAGNI approach at this scale?
  2. 2Cross‑team, there's a proposal to standardize a DSL for future use cases that aren't defined yet. How would you evaluate this from a YAGNI perspective?
  3. 3When setting long‑term engineering standards, how do you incorporate YAGNI to avoid technical debt across multiple product lines?

Follow-up Questions

  • Can you give an example where following YAGNI saved you time or effort?
  • What signals tell you it's safe to defer a feature?
  • How do you convince stakeholders who push for future‑proofing?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.