Chapter 9. YAGNI
YAGNI stands for “You Ain’t Gonna Need It.” It is the battle cry of agile project development to help prevent speculative development. Speculative development occurs when developers tell themselves, “I’m sure I’m going to need some additional functionality later, so I’ll go ahead and write it now.” This is a slippery slope. The better approach is to build only what you need right now.
Speculative development harms software because it adds complexity to code prematurely. As Andrew Hunt and David Thomas stated in The Pragmatic Programmer (Addison-Wesley), software suffers from entropy, which is a mathematical term for the amount of complexity in a system. Entropy hits software hard because complexity makes it hard to make changes, understand the code, and add new features. Usually, in the physical world, things tend toward simplicity unless you add energy to disrupt it. Software is the opposite: because it is so easy to create, it tends toward complexity (in other words, it takes the same physical effort to create both complex and simple software). It can take great effort to pull software back toward simplicity.
All developers fall into the gold plating trap. Speculative development is a hard habit to break. It’s really hard when you are in the heat of development to be objective about the clever idea you just had. Will it make the code better, or just add more complexity? ...
Get The Productive Programmer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.