The following is excerpted from
ExtremeProgrammingIsNotTheOneTrueFaith ...
-
- YAGNI is "only build it if you NEED it". Well to me at least .... - AdamHill
-
- I think I would amend that to say "only build it if you NEED it RIGHT NOW". --BradAppleton
-
- Correct, Brad. YAGNI means "only build it if you need it right now". We don't apply judgment: if our current task can succeed without a thing, we don't build the thing. --RonJeffries
I think I may have some insight behind why
YouArentGonnaNeedIt (YAGNI) is such a red-hot bone of contention among many here on the Wiki. I suspect that that YAGNI is perhaps inaccurately named. The premise implied by the YAGNI name can often be dead wrong,
however the advice YAGNI gives is often still correct.
I think the key to this is exposed in the above excerpt. The issue is not so much whether or not it will be needed in the future, its whether or not it is needed
right now!
Sometimes, we in fact know for a certainty that we
are indeed going to need it later. It may not even be a guess, but a pure unadulterated fact. Perhaps we know for sure that we have signed up to do that feature for the increment that is due for delivery six months from today. Or perhaps we have so much experience with our craft, and our domain, and with our customers, that our instinct regarding what will be needed down the road is uncannily accurate (some of us can even produce empirical evidence of our prediction success rate for such features).
I think much of the argument over YAGNI is over whether or not it
will be needed. I also think most of that debate is misplaced. I honestly dont feel it matters so much if it will be needed, and how good you are at knowing that.
In fact, many times (depending on many factors of course) you really will need it!
But whether or not it is, it's not the point we should be belaboring IMHO.
Correct me if Im wrong, but I think what
CostOfDesignCarry was trying to get at, is that even if I
will
need it
later,
that doesn't always mean that I
should
do it
now.
Based on what Ron said above, I should only do it
now if the need
for it is
extreme, meaning it is only needed for the
current task (and not necessarily several tasks later on down the line).
Hence the name
ExtremeNeed. I would humbly suggest
ExtremeNeed as a possible alternative to the name
YouArentGonnaNeedIt, because I feel the latter name in fact isnt always correct (sometimes you really do need it
later) and is more
likely to obscure the real issue to focus on (namely, whether or not you
have an
ExtremeNeed for it).
So, have I hit on something here, or am I way off base? --
BradAppleton
I think you have, Brad. I'm now inclined to think people greatly overestimate the odds that they will need something -- and there we go again with the debate! ;-) That debate will likely be brought up by some regardless, but it makes sense not to encourage the tangent. I would suggest a different name, however, something more in the Xp style. What about
YouDontNeedIt? --
KielHodges
or something even more powerful, like
YouDontNeedItYou#@@$!@# :-) --
JoshuaKerievsky
Im sure folks do overestimate many times as Kiel says. Just as Im sure
that many times, there is no guesswork involved: the need for the feature
is already a known fact that has been agreed to between customer and
supplier - it just isn't scheduled/promised till significantly later on.
But there is still the temptation while visiting a piece of code to say
"gee - as long as Im here ..." (regardless of whether the "extra" thing
is known to be needed, or simply surmised). Which is why I think the focus should be upon the exigency of the need, rather than its (un)certainty.
I agree that
ExtremeNeed doesnt sound very rule-like (more like a criteria than an imperative). What about
YouDontNeedItRightNow (or
YouDontWantItNow
or
SaveItForLater)? --
BradAppleton
Well done, team! YAGNI is what you SAY to yourself to get yourself to do what you gotta do. In YAGNI's case, what you gotta do is stay on track and trust that your other rules will leave the code ready for whatever you need next. Regarding the thing you were thinking of, its time will come and you, and the code, will be ready for it. --
RonJeffries
How about
YouDontNeedItYet?
In a way it's applying YAGNI to the YAGNI decision. You don't need to know whether you are going to need the feature. You just need to know whether you need it
now. That's a much easier and less controversial decision.
--
DaveHarris
There's particular merit to this one, even though I have great fondness for the original, having penned it :) Good ideas, gang. -rj
-
- So are you going to refactor the pages to say YDNIY then? It does seem much clearer and harder to object to. -- Aspirant.
I don't know where I heard it, but didn't one of you all say "In XP our motto is get it right the next time." Sounds like a related thought. I know that I have dealt with coworkers in that way.. to avoid controversy as
DaveHarris says. We think of something cool to do and I step back and say "Gee, when we get all the stuff done that we really need to do, maybe we can do that." It just turns out that those days never arrive. This is kind of like one of
MichaelJackson's rules for optimization: "Don't optimize yet." --
MichaelFeathers
I'll suggest "
CertainNeed", as the issue is the relative certainty of a design need. The term "
ExtremeNeed" implies a threshhold much higher that that which I use in decisions like this, though the tie-in to XP is tempting. "
ImminentNeed" had a nice, subjective feel to it, but it has too strong a sense of urgency.
-SM