DEV Community

Christian Duarte
Christian Duarte

Posted on

Lab 5 - Refactoring

Improvements...

This week I had the task of focusing on improvements I can make to my code, while keeping functionality, and attempting to rebase my branches.

Fixes...

The fixes I chose to implement this week were removing global variables, separating my prompt logic into its own function, removing redundancies in my code, and changing variable names for better readability.

Rebase...

The interactive rebase actually went a little worse than I thought. At first I don't think I properly switched branches, even though I did a pull, something was up, and my branch had older commits tied to it for some reason which I don't know. I only had 2 commits luckily, because I did a lot of work in the first one by accident, not realizing I should have separated my work like the assignment called for.

Bugs and Better Code...

While working, I did find some bugs and even broke my program for a little bit of time there. When refactoring the main prompt logic to be in its own function, I broke the program and nothing was being added to the prompt, being an issue both with my logic reworking, and the removal of my global variables. I was able to get past this however with some Magic coding skills, and I was able to solve my mistakes. I didn't like finding mistakes, bugs, and breaking my code, because I had a lot to do throughout the week and was burnt out by the time I was able to start this task. It was a long road this week, but I'm happy my bugs are seemingly solved for now.

Project History...

Finally, as mentioned before, I did not have a fun time with rebase due to my own messing's up with git. In my git commit history there were 4 commits, 2 of them being from older commits in previous labs, and 2 of them being the new commits I made, despite it being a new branch. This was my fault and I am still trying to find out why, especially as I have now made a mess of my git history it looks like.
Image description
In the end, I learned no matter what, there is always room for improvement, and my adventures with git and failing to complete tasks will only grant me more experience as I continue.

Top comments (0)