You ain't gonna need it… You ain't gonna need it…

Two parables about the YAGNI principle: both true stories.

Long time ago in a company far far away there was a piece of software. Every time we designed a new feature, we were told that “it must work when the computer is disconnected from the network”. Sometimes it did not matter, sometimes it complicated the design a lot. Punch line – no one ever actually checked that the software works when disconnected from the network. I tried it once, and it promptly hung on startup. Meaning: the rule about working without network existed only in theory, and its only real effect was to make things more complicated. No one ever cared about it in practice, but no one dared to question it either, so it poisoned our lives for years.

Different company, different piece of software, not so long ago. Pretty much every “update” operation in the software had a parameter for “as of” date. So, you could, say, cancel your subscription as of next Monday. This parameter existed only on the server side: no actual UI had it, and all real requests were to be executed immediately. Nevertheless, the parameter was passed around the entire body of the server code. No one asked questions like what would happen if I try to kill my own grandfather cancel my subscription as of before it was activated, or if I activate the subscription in the year 2038, but then get my account closed in 2017. There were no checks for that in the code. When we removed the parameter, not a single unit test failed (and we had quite a few). Meaning: someone thought it would be cool to have an “as of” date, but they never contemplated all the consequences, and this parameter was never used in practice. Its only real effect was to introduce annoying bugs when the client clock and the server clock went out of sync, giving users an opportunity to try to kill their own grandfather.

Leave a Reply

Your email address will not be published. Required fields are marked *