Rewriting my code using functions as components has also allowed me to take an in-depth look into my code and see where I have been inefficient and where I made subtle mistakes. By doing this audit I could take a fresh look at the problems I was trying to solve and decide whether or not my initial approach was acceptable. I could also take a look at the overall architecture of my code. Maybe I felt that by the end of the project I had planned it poorly and some things I hadn’t accounted for had created needless complexity, or maybe I had made it difficult to implement a certain component into the project. Either way, I could now fix this issue and internalise the steps that I can take to avoid facing it again in the future.
Finally, rewriting code can be a good tool for vanity. Maybe you’re feeling a little bit of impostor syndrome and have been having difficulty grasping some concepts recently. Taking a look at an old project and rewriting some parts of it with the new skills you’ve learned in the meantime is a great way of visualising your progress. You will literally see the improvements you’ve made and if you made any glaring mistakes, the performance of your application can even improve visibly. It’s always a good feeling to look back on your code and see that it is readable and maintainable and if you were to drop in another developer in your seat, they could understand what you were doing reasonably quickly.
Rewriting code can seem like a useless exercise to some, but it is one of the easiest ways to see your personal improvement and to stay on the cutting edge. If you’re learning something new and are uninspired to write a new project, you can merely edit an old one and apply the new concepts to that! Give it a try and maybe you’ll be surprised.