Last weekend I had a little DIY challenge. We found out our kitchen sink was leaking so I had to take it out and re-seal. And so a little bit of local demolition went on and the supporting cupboard had to be emptied off all stuff, including our collection of teas. Few feet of silicone later I was ready to clean up. And as we looked around we’ve noticed the teas could perhaps go to another cupboard.
Few days later and we are still amazed how much better the now location is. Teabags are within reach, ordered, clearly visible and neatly laid out. If it wasn’t for the sink we would still be kneeling down to rummage for the right box.
OK , you might wonder what does it have to do with code. Well, I realised it actually might. The situation reminded me of the many times where there is this bit of code, those API calls I use over and over again. It works, it works well enough and perhaps only at times it fells just slightly uncomfortable. I almost subconsciously feel it could be improved…
And then comes the day when I have to change some plumbing, do a bit of refactoring and suddenly the same old bit of code behaves in a much better way. If finds new space which makes it cleaner, more accessible and more robust and all was needed was a little opportunity to move things around.
I now know that I need to move my teas from time to time to make sure they are still in the best possible location. I also remember, and keep reminding myself – that code has to change as well to remain in an optimum state. It needs to be refactored often and at every opportunity. This is how it gets better.