Recently I have had the great fortune to find an old university project on a USB drive that I had thought I had lost some time ago. I decided to look over the code once again. It’s surprising what a difference time can make to your coding style. My style has changed dramatically since then.
Despite the changes I noticed, I also found some possible issues, inefficiencies and other flaws in the code that I would never let pass now. I also found some things cropping up in my code, things I have been using for years that I never think about. When I see it written down I skip over it. Looking at old code of mine made me think about these structures and techniques again. As I read more of the code I started to see ways of improving these techniques, making them faster, more robust, better.
Many people know the virtues of reading other peoples code, but I have come to realize that it is also important to read your own code. Not just in the following days or a month or two but after years. If you have access to older code, go back and compare it to your current code. Consider how you have achieved the codes objective.
How would you do it differently now?
Do you know anyway of improving your older code?
Have you forgotten about a technique or structure that would still prove useful?
I must admit that this may not work for everyone, but recently, going over some of my older code has helped me see problems in different way, and find solutions I wouldn’t have thought of before.
Give it a try, you’ll be surprised by what you can treat yourself.