YAGNI ("You Ain't Gonna Need It") is an Extreme Programming (XP) principle stating that functionality should only be added when it is actually needed, rather than when it is foreseen. It prevents overengineering and reduces technical debt by avoiding the creation of unnecessary, complex features that often go unused.
source: AI overview of Wikipedia
Key Aspects of YAGNI:
- Benefits: Reduces the cost of building, testing, and maintaining unnecessary code. It also minimizes the "cost of delay" for actual, needed features.
- Application: It is commonly used in Agile development to maintain a clean codebase and focus on current, tangible value.
- Drawbacks/Risks: If taken too far, it can lead to a lack of necessary architectural planning, making future refactoring difficult. It is not an excuse for ignoring security or essential design.
Example: Instead of building a complex, generic search algorithm for every conceivable scenario, you only implement the specific filtering required by the user right now.
source: AI overview from martinfowler.com
When to Apply YAGNI:
- When tempted to write "future-proof" code.
- When features are proposed based on speculative, unverified future needs.
- When complex abstractions are added prematurely.
source: AI overview of Reddit
No comments:
Post a Comment