You ain't gonna need it
From CSSEMediaWiki
Revision as of 01:17, 17 July 2009 by Aidan Bebbington (Talk | contribs)
You ain't gonna need it, or short YAGNI, suggests to programmers that they should not add functionality until it's necessary.
Ron Jeffries, one of the 3 founders of Extreme Programming Software Development Methodology, states: "Always implement things when you actually need them, never when you just foresee that you need them." According to him you often will hear yourself saying: "We are going to need..." Just resist that impulse and stick to the essential functionality.
The benefits
- Chasing less bugs. Nothing is more of a pain than chasing bugs through code that isn't even executing - lots of dead ends!
- It keeps the cognitive load down when looking at strange code. It self-documents because, by it's very existence, it honestly declares what the software actually does
- Dead code is not part of the integration-testing loop, so in a test-driven process, it's not valid code. It also tends to fall behind requirements.
"The best way to implement code quickly is to implement less of it. The best way to have fewer bugs is to implement less code."[xp]