|Research, training, consultancy and software to reduce IT costs|
You Aren't Gonna Need It, revisited
It is better to spend time on system structure, documentation and testing than on adding features that you do not currently need.
You Aren't Gonna Need It, or YAGNI, is a programming principle which states, "Always implement things when you actually need them, never when you just foresee that you need them."
YAGNI saves time because you do not develop features that you do not actually need. YAGNI keeps your code simpler because it is not polluted with unnecessary features. YAGNI is realistic because what you imagine you want now will probably not be exactly what you do need, when you do finally need it.
I try to follow YAGNI when developing systems. However, recent work on our Metrici Advisor product has made me question whether we have been applying YAGNI too much.
This has made me wonder whether we had applied YAGNI too hard. Had we created services which were so specialised to the user interface that they are not good candidates for reuse?
First, we have good tests for these services. Adding a new option is not that hard when your tests guarantee that you are not going to break existing functionality.
Second, we have reliable documentation. This makes it easy to understand what is going on and, for example, work out how to add options that do not invalidate existing calls.
Although it is frustrating to rework old code, I think on balance we were right to keep the services simple initially. If we had added to them, we would probably not have added exactly the features we need now. And by spending our time on design, on documentation, and on testing, we did prepare the services for future use.
So is YAGNI worthwhile? When it comes to functionality, You Aren't Gonna Need It is a good principle. But you are going to need testing, and documentation, and good structure, so spend your time on these rather than on building functionality that you might never need.Next: Nightmare of the typing pool
Minimal IT: research, training, consultancy and software to reduce IT costs.