Refactoring and Rewriting Git History

 Introduction 

This week the focus was on creating a refactoring branch of our link checker CLI's and using that to make improvements to code to increase readability, maintainability and clean the code up. The goal was to use the refactoring branch to make incrementable changes one by one and then rebase those changes into one single commit to be merged with with master branch.   


My Focus for Improvements 

For the improvements I wanted to make on my CLI, I wanted to focus on making my code more readable and remove as much ambiguity as I could. I felt that the code was already portable enough to be maintained by me but there were multiple instances were I had written code that was vague and hard to interpret, whether it be using numbers without explanation  or having variable names that were not clear. First I went to solve the problem of how I parsed and filtered out the command line arguments. I decided the best solution would be to retrieve the arguments and then send them to a function that would handle how the arguments are used. I thought this process would be simple but I did run into some issues that caused my program to break and also pointed me to other bugs I had with the CLI. I cleaned these up, tried to make sure there were no other uncaught bugs and added this commit. Next, I decided to go through and remove the vague numbers I was using to handle options and replaced them with more clear strings. Finally I decided to go through and rename any variables that weren't clear in their meaning. 

Using Git to Refactor and Rebase

As I made each change I made separate commits to my branch. Once I was ready to add these changes to the master, I used the rebase editor to squash two of the commits with the first commit into one. This allowed all the changes to show on commit and then I merged this with my master branch. The process was not to difficult after doing the introductory reading on watching the video on the subject. Overall I think was a useful way to work on a project and is something I will be using in the future for sure. 

Comments

Popular posts from this blog

Adding Features and Pull Request

Planning for Release 0.4

Release 0.4 Progress - Organizing the code