During a recent coding dojo session, we spoke about YAGNI - i.e. "You aren't going to need it".
In this situation, we discussed how many numbers we should support passing to a method in a calculator application.
There's no technical limit to how many numbers we can pass, but there may be a requirement where we only need to add or subtract two numbers. In that case, we don't need to calculate three or more numbers, so there's no benefit or value to writing that code.
If we follow YAGNI, we only write the code we need now. If the requirement changes in the future, we revisit the code and change it as required.
- Oliver
Was this interesting?
About me
I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.