YAGNI: You Ain't Gonna Need It
YAGNI is a principle of radical simplicity: don't build features now just because you *think* you'll need them later. It forces focus on current requirements, preventing wasted effort on speculative work.
THE MENTAL MODEL: YAGNI, or "You Ain't Gonna Need It," is a principle from Extreme Programming that combats speculative development. It mandates building only what is necessary for the immediate, defined requirements, and nothing more. The cost of building something you don't need isn't just the initial development time; it's the ongoing cost of maintaining, testing, and navigating that extra complexity for the lifetime of the code.
HOW IT WORKS: In practice, YAGNI is a question you ask continuously: "Is this the absolute simplest thing I can do to meet the current requirements?" If you find yourself adding extra configuration options, helper functions for a use case that doesn't exist yet, or database columns "just in case," you are likely violating YAGNI. The discipline is to implement the feature as requested and stop.
WHEN TO USE IT: YAGNI is a cornerstone of agile methodologies. It is most effective in environments where requirements are evolving and feedback loops are short, such as when building a Minimum Viable Product (MVP). It helps teams deliver value faster by preventing "gold plating"—adding features that provide no immediate value to the user.
WHEN NOT TO USE IT: YAGNI is not an excuse for lazy or poor architectural decisions. While you shouldn't implement a complex caching layer before you have a performance problem (that's YAGNI), you should design your data access layer in a way that would allow a cache to be added later without a complete rewrite. Deferring feature implementation is smart; creating a brittle, un-extensible system is not.
ONE CANONICAL EXAMPLE: A team is building a user profile page. A developer thinks, "Users might want to export their profile to a PDF someday. I'll add an 'Export' button and the basic logic for it now." Applying YAGNI, the team would reject this. The current requirement is only to display the profile. The export feature is not needed now, adds complexity, and may never be requested. If users ask for it later, it can be built then, based on a real need.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.