Why waste time building things no one will ever use?
Why YAGNI (You Aren't Gonna Need It) in LLD? - Purpose & Use Cases
Imagine building a system by adding every possible feature you think might be needed someday, even before anyone asks for them.
You spend weeks designing complex modules that may never be used.
This approach makes development slow and confusing.
It wastes time on unnecessary work and creates complicated code that is hard to maintain.
It also causes frustration when you have to fix bugs in parts no one even uses.
YAGNI teaches us to build only what is needed right now.
It keeps the system simple, easy to understand, and faster to develop.
By focusing on current requirements, you avoid wasted effort and reduce errors.
def build_feature_x(): # complex code for a feature not requested yet pass
def build_feature_x(): # build only when feature is actually needed pass
It enables faster delivery of working systems that are easier to change and grow over time.
Think of a kitchen: buying and installing every gadget you might use someday clutters the space and slows cooking.
Instead, you add tools as you discover you really need them.
Build only what you need now, not what you might need later.
Keep your system simple and maintainable.
Save time and reduce errors by avoiding unnecessary features.
Practice
Solution
Step 1: Understand YAGNI meaning
YAGNI stands for "You Aren't Gonna Need It" and advises to avoid building features before they are necessary.Step 2: Match principle to options
Build only features you currently need matches the idea of building only what is needed now, while others suggest building for future or complexity.Final Answer:
Build only features you currently need -> Option AQuick Check:
YAGNI = Build only what you need now [OK]
- Thinking YAGNI means planning for all future needs
- Confusing YAGNI with over-engineering
- Assuming YAGNI discourages any planning
Solution
Step 1: Identify core YAGNI practice
YAGNI advises to implement only what is necessary now, avoiding premature additions.Step 2: Evaluate options for current need focus
Implement only the core functionality needed for the feature now focuses on core functionality now, while others add future or unnecessary work.Final Answer:
Implement only the core functionality needed for the feature now -> Option DQuick Check:
YAGNI = Build core now, skip extras [OK]
- Adding features or tests for future needs
- Over-engineering database for unknown data
- Writing unnecessary logs before real errors occur
Solution
Step 1: Analyze the caching layer addition
The team added caching before it was needed, anticipating future load.Step 2: Relate to YAGNI principle
YAGNI discourages building features before they are actually needed, so this is a violation.Final Answer:
They built a feature they didn't need yet -> Option CQuick Check:
YAGNI violation = building unneeded features [OK]
- Thinking preparing for future is YAGNI
- Confusing simplification with premature optimization
- Assuming caching always simplifies system
Solution
Step 1: Identify the developer's action
The developer added a complex system for roles not currently needed.Step 2: Connect to YAGNI principle
YAGNI advises against adding complexity before it's necessary, so this is a violation.Final Answer:
The developer ignored YAGNI by adding unnecessary complexity -> Option AQuick Check:
Unneeded complexity violates YAGNI [OK]
- Assuming scalability means following YAGNI
- Believing all future roles must be planned now
- Confusing simple with insufficient
Solution
Step 1: Understand current user needs
Users do not require encryption now, so it is not immediately necessary.Step 2: Apply YAGNI principle to design decision
YAGNI advises to avoid building features before they are needed, so skip encryption now.Final Answer:
Skip encryption for now and add it when users need it -> Option BQuick Check:
YAGNI = build features only when needed [OK]
- Building features just to avoid future work
- Assuming all users need encryption immediately
- Over-engineering system upfront
Ready to prove it?
Pass the test and this pattern moves unknown
