Andrew's Digital Garden

YAGNI

You ain't gonna need it.

"Always implement things when you actually need them, never when you just foresee that you may need them."

What you think now may be wrong in the future. Although a feature is planned in 6 months, circumstances change and the feature may be deprioritised or removed altogether.

Even if you are correct, building a presumptive feature incurs many costs. Some are apparent immediately, with others becoming apparent later.

Initially building the feature incurs the cost of build. The presumptive features takes time and effort to build, which could have been spent elsewhere. Even if the feature is 'correct' and built well, this is a cost incurred now. If the correct feature was built but it was built incorrectly, you incur the cost of repair.

Past those costs, if the feature is correct and built correctly, you still incur two 'hidden' costs. The first is the cost of delay - the original feature gets delayed while the presumptive feature is built. Often it's not actually cheaper to build it now ratehr than build it later. That cost should be compared with the cost of delay. The other cost is the cost of carry. The code for the presumptive feature adds complexity, which makes the software harder to debug, maintain, etc.

YAGNI only applies to code that supports a presumptive feature, not an effort to make the software easier to modify.

[[principles]]

YAGNI