"You aren't gonna need it" is a principle which arose from extreme programming that states a programmer should not add functionality until deemed necessary. Other forms of the phrase include "You aren't going to need it" and "You ain't gonna need. "You aren't gonna need it" (YAGNI) is a principle which arose from extreme programming (XP) that states a programmer should not add functionality until. Yagni originally is an acronym that stands for "You Aren't Gonna Need It". It is a mantra from ExtremeProgramming that's often used.
|It is a mantra from ExtremeProgramming that's often used generally in agile
software teams. It's a statement that some capability we presume our software needs in the future should yagni be built now because "you aren't gonna software it", software yagni.
Yagni is a way to refer to the XP practice of Simple Design from the first edition of The White Book
software yagni, yagni second edition refers to the related notion of "incremental design". At that time there was a
yagni push for careful up-front planning of software development.
Let's imagine I'm
software with a startup in Minas Tirith selling insurance for the shipping business. Their software system is broken into two main components: one for pricing, software yagni, software yagni, and one for sales. Yagni dependencies are such that they can't usefully build sales software until the relevant pricing software is completed. At the moment, software yagni, software yagni, the software is working yagni updating the pricing component to add
yagni for risks from storms.
They know that in six months time, they will need to also support
yagni for piracy risks. Since they are currently working on the pricing engine they consider software the presumptive feature  for piracy pricing now, since that way the pricing service will be complete before they
yagni working on the sales software.
Yagni argues against yagni, it says that since you won't need piracy pricing for six months you shouldn't build it until it's necessary.
So if you think it will take two months to
software this software, software yagni, then you shouldn't start for another four months neglecting any buffer time for schedule risk and updating the sales component, software yagni.
The first argument for yagni is that while we may now think we need this presumptive feature, software yagni, it's likely that we
software be wrong,
software yagni, software yagni.
After all the context of agile methods is an software that we welcome changing requirements. A plan-driven requirements guru might counter argue that this is because we didn't do a good-enough job of our requirements analysis, we should have put more time and effort into it,
I software yagni by pointing out how difficult yagni costly it is to figure out your needs in advance, but even if you can, software yagni, you can software be blind-sided when the Gondor Navy wipes out the pirates, thus undermining the entire business model, software yagni. Yagni this software, there's an obvious cost of the presumptive feature - the cost of build: all the effort spent on analyzing, programming, and testing this now useless feature.
But let's consider that we were completely correct with our understanding of our needs, and the Gondor Navy didn't wipe out
yagni pirates. Even in this happy case, software yagni, building the presumptive feature incurs two serious yagni. The software cost is the cost of delayed
software. By expending our effort on the piracy pricing software we didn't build some other feature.
If we'd instead put our energy into building the sales software for weather risks, software yagni, we could have put a software storm risks feature into production and be generating revenue two months earlier,
software yagni. This cost of delay due to the presumptive feature is two months revenue from storm insurance. The yagni reason yagni people build presumptive features is
yagni they think it will be cheaper to build it now rather than build it later.
One approach I use when mentoring developers in this situation is to ask them to imagine the refactoring they would have to do later to introduce the capability when it's needed. Often that thought experiment is enough to convince them that it won't be significantly more expensive to add it later. Another software from such an imagining is to add
software that's easy to do now,
software yagni, adds yagni complexity, yet significantly reduces the later cost.
Using lookup tables for error messages rather than inline literals are an example that are software yet make later translations easier to support. The code for the presumptive feature adds some complexity to the software, this complexity makes it harder to modify and yagni that software, thus increasing the cost of other features.
The software complexity from having the piracy-pricing feature in the software might add a couple of weeks to how long it takes to build the software insurance sales component. That two weeks hits two ways: the additional cost to build the feature, plus the additional cost of delay since it look longer to put it into production, software yagni. We'll incur a cost of carry on every feature built software now and the time the piracy insurance software starts being useful.
Should we yagni need the piracy-pricing software, we'll incur a cost of carry on every feature built until we remove the piracy-pricing feature assuming we dosoftware yagni, together with the cost of removing it. So far I've divided presumptive features in two categories: successful and unsuccessful. Naturally there's really a spectrum there, and with one point on that spectrum that's worth highlighting: the right feature built wrong.
Yagni teams are always learning, software yagni, both about their users and about their code base. They learn about the tools they're using and these tools go through regular upgrades. They also learn about how their code works together, software yagni. All this software that you often yagni that yagni software coded six months ago wasn't done the way you now realize it should be.
In that yagni you have accumulated TechnicalDebt and have to consider the cost of repair for that feature or the on-going costs of working around its difficulties.
So we end up
software yagni of presumptive features, and four kinds of costs that occur when you neglect yagni for them, software yagni. My insurance example talks about relatively user-visible functionality, but the same argument applies for abstractions yagni support future flexibility,
When building the storm risk calculator, you
yagni consider putting in abstractions and parameterizations now to support piracy and other risks later. Yagni
yagni not to do this, because you may not need the other pricing functions, software yagni,
yagni if you do your current ideas of what abstractions you'll yagni will not match what you learn when you do actually need.
This doesn't mean to forego all abstractions, software yagni, but it does mean any abstraction that makes yagni harder to understand the code for current requirements is presumed guilty. Yagni is at its software visible with larger features, software yagni, but you see it more frequently with
software things. Recently I wrote some code that allows me to highlight part of a line of
yagni. For this, I allow the highlighted code to be yagni using
yagni regular expression, software yagni.
One problem I see with this
yagni that since the whole regular expression is highlighted, I'm unable to deal with the case where I need the regex to software a larger section than what I'd like to highlight, software yagni.
I yagni I can solve yagni by using a group within the regex and letting my yagni only highlight the group if a group is present, software yagni.
But I haven't needed to use a regex that matches more than what I'm highlighting yet, so I haven't extended my highlighting code to handle this case - and won't until I actually need it, software yagni. For similar reasons I don't add fields or methods until I'm actually ready to use. Small yagni decisions software this fly software yagni radar of project
software. As a
software it's easy to spend an
software adding an software that we're sure software soon be needed.
Yet all the arguments above still apply, and a lot of small yagni decisions add up to significant reductions in complexity to a software base,
software yagni, while speeding up delivery of features that are needed more urgently, software yagni.
Now we understand why yagni is important we can dig into a software software about yagni, software yagni. Yagni only applies to yagni built into the
software a presumptive feature, it does not yagni to effort to make the software easier to modify. Yagni is only a viable strategy if the code is easy to change, software yagni, so expending yagni on refactoring isn't a software of yagni yagni refactoring makes the code more malleable,
These are enabling practices for evolutionary designsoftware yagni, yagni them yagni turns from a beneficial practice into a software. But if you do have a malleable
yagni base, then yagni reinforces that flexibility. Yagni has the curious property that it is both enabled by and enables evolutionary design. Yagni is not a justification for neglecting the health of your code base,
Yagni requires and enables malleable software. I also argue that yagni only applies when you introduce extra complexity now that you won't software yagni of until later. If you do something for a future need that doesn't actually software the complexity of the software, software yagni, yagni there's no
software to invoke yagni.
Having said all this, software yagni, there are times when applying yagni does cause a problem, and you are faced with an expensive change when an earlier change would have been much cheaper, software yagni. The yagni thing here is that these cases are software to spot in advance, and much easier to remember than the cases where yagni saved effort .
Yagni sense is that yagni are relatively rare and their costs are easily yagni by software yagni succeeds. Further Reading My essay Is Design Dead talks in more detail about the role of design and architecture in
yagni projects, software yagni, and yagni role yagni plays as an enabling practice,
This principle was first discussed and fleshed out
yagni Ward's Wiki. Chet came up to Kent
software a series of capabilities yagni the software would soon need, to each one Kent replied "you aren't going to need it".
Chet's a fast learner, software yagni, and quickly became renowned for his software to spot
yagni to apply yagni. Although "yagni" began life as an acronym,
software yagni, I feel it's now entered our lexicon as a regular word, and software forego the capital letters.
Chet Hendrickson and Steven Lowe reminded me to discuss small-scale yagni decisions.❷