Decluttering the Desktop
One of the issues I sometimes have with coding projects is the multiple duplicates I will inevitably have after a project is over. These duplicates will populate my desktop screen and take up way too much space and memory than they have any right to. These duplicates are the result of me desperately trying to keep a working copy of the project while I try to refactor the code or add new features. By the end of the project, my desktop may have at least half a dozen folders with more or less the same name, with more or less the same contents. Even when I started using Git, I may have multiple repositories to keep track of different versions. This practice probably would have continued ad nauseam. But I have been saved from such inelegant procedures after learning more about git branches.
This week, we revisited our own repositories from the first week. We were to add new features and utilize git branches to manage the different versions that would arise. I decided to implement support for — all, — good, — bad. I was already planning to add a similar feature in my Release 0.1. The implementation itself wasn’t too difficult and was a matter of adding the conditionals for printing the statements depending on the options used. I think that I may like to extend this feature and have a counter for the different types of links and have them displayed in a table. It’s something to consider for the future. I may even create an issue for it.
The second feature I implemented was to output the results in JSON format. I thought that this may be a useful feature since JSON is used so widely. I decided to write a different function for this to keep my previous function that handled HTTP requests from becoming bloated. One thing that I noticed when I was testing the program was that it took a while to process the URL links and without the constant output to the screen, the user didn’t know what was going on. I put a message to the user that asked them to wait as the URLs were being processed. But I still found this to be lacking. To improve the UX, I decided to look for ways to add a progress bar. Luckily, the library that I was using had support for such a thing. Now, the user can see the progress of the tool as it goes through the file or website testing the links before it outputs the results as a JSON string.
The merging of the two branches went by fairly smoothly as I kept the functions dealing with the two different features pretty separate. However, I didn’t test my code as well as I should have. Testing can take quite a bit of time and some bugs managed to slip past me. One particular bug was when I was comparing an int with a string. As I am still transitioning from strongly typed languages like c++ and java, I am still getting used to the boundaries I can push with python’s type system. I had to fix the bug while it was on the master branch rather than the branch it originated from.
Overall, I’ve learned a bit more about using git branches. It will surely save me a bit of space on my hard drive, not to mention a lot of confusion, something that I will be truly grateful for.