YAGNI (You Aren't Gonna Need It)
YAGNI captures a core philosophy of agile development: don’t write code for features that haven’t been requested or aren’t immediately needed.
If you’re implementing Module A and think “in the future we might need Module B to do X, so I’ll code some hooks for that now,” YAGNI advises against it because that future feature may never come or may change drastically.
This principle directly fights over-engineering. To apply YAGNI successfully, teams rely on confidence in refactoring. You defer a feature only if you trust you can add it later at low cost.
Agile methods provide that safety net via good test coverage, refactoring tools, and continuous integration. YAGNI pushes the problem of complexity to when it’s actually needed.
- YAGNI is here to remind developers to focus on current tasks rather than implementing features that aren't needed now.
- Anticipating future needs often leads to over-engineering, and this adds complexity and maintenance issues.
- YAGNI encourages iterative development. You implement minimal solutions and refine or extend them when needed.
评论
?
参与讨论