YAGNI (You Aren’t Going to Need It) is a principle that keeps us from over-engineering the system. Build today only those things that you need today. Things that we need tomorrow, we can build tomorrow.
Yet if we apply that principle blindly, as beginners often do, we can end up painting ourselves in a corner by not looking ahead and considering what might be coming. If we don’t think about tomorrow then we might end up making decisions today that actually make tomorrow much harder than it needs to be.
Doing YAGNI well does require us to think, at least a little bit, about the future while only implementing today, what we need today.
For example, if we are building a shopping cart app, we might find that today we only need to put one item in the shopping cart. If we apply YAGNI blindly then we might implement our database with only one possible field for an item, rather than as a collection. That would require rework the moment we want to add the second item. If we think ahead for even a moment, we would realize that a shopping cart should contain a collection of items, rather than one.
YAGNI is an exercise in focus, not an excuse to stop thinking.