Not much was done for this week, except that I spent most of that time refactoring the caching mechanism. When I first started on the project, I was frustrated at the messiness of the codebase and how it took me longer than expected to understand the workings of the application. But now I was about to make that same mistake with my caching implementation.
The class that represents the cache REST API endpoint was basically doing everything, therefore making it look more complicated than it actually is. So to address that, I tried to delegate some aspects of the mechanism to separate classes, while also attempting to keep in line with the Single Responsibility Principle (SRP). Thankfully I had some tests in place, i.e both the gtest unit tests as well as the cURL tests script, to verify that I have not introduced any new bugs as a result of my changes. Without the tests, refactoring would have been unnecessarily difficult or even impossible in some circumstances. There is one unit test though that was broken which I have yet to fix, but I should get it passing again soon.
The changes I had made were much better than my previous implementation, but of course there are still some things that I wish to change. However, what I have done for now is enough for me to feel satisfied and move on. Refactoring is important but it could take quite some time like how it did for this one. I know I could have done this at a later time, but I felt that it was kinda bad that I need to address it immediately while caching is still fresh in my mind. I’ll keep note of the things I would come back to change later on. Lately, I have been using Trello boards to keep track of the TODO things as well as the things I am currently doing now and that I already have done, so I’ll be sure to make good use of it. The next major thing I would have to do is to try to integrate my project with another sister project, which is the one Ahid is supposed to be working on. Quite a few changes had been made to my project, so we have to ensure that the integration works even with these new changes in place.
Well that’s it for this blog post. Also, apparently, this week is Nadia‘s last week of her internship. It was unfortunate that I wasn’t able to make it for her farewell lunch. She has been interning for the past 6 months, and I’m glad that she is able to get by and stay strong, despite having Dr Shawn scold her time and time again for the mistakes that she made. But I hope the internship gives her the experience she needs so that she could better herself for the future. To Nadia, I hope that you don’t forget about the fun times we had, especially on the Texas Chicken days 😄. All the best for whatever lies ahead!