Sobes.tech
Middle

Что такое YAGNI (You Aren't Gonna Need It)?

sobes.tech AI

Answer from AI

YAGNI is a development principle that states: "You Ain't Gonna Need It." Its essence is to avoid adding functionality until it is actually needed.

Main ideas of YAGNI:

  • Avoid premature optimization and "gold plating": Do not build complex, universal solutions "just in case".
  • Focus on current requirements: Develop only what is necessary for the current tasks.
  • Simplicity: The simpler the code, the easier it is to maintain and modify.
  • Save time and resources: Do not spend time developing and testing functionality that may never be used.
  • Reduce complexity: Less code means fewer potential bugs and a more understandable system.

Applying YAGNI in practice:

  • Do not add fields to the database "for the future".
  • Do not write universal configuration files if simple ones suffice.
  • Do not develop abstract classes or interfaces in advance until their necessity becomes apparent.

This does not mean a complete rejection of planning, but rather a call for minimalism in current implementation. Going back and adding functionality as needed (refactoring) is normal.