Refactor a code factor

RMAG news

Greetings,

This week we had to learn about refactoring an existing code base. This was a new experience for me as a student you don’t often have to go back to an old assignment. However, since we were working with our existing AI CLI tool we had something to work with.

Additionally, we also had to use git rebase to squash the changes we made for the refactor. I’ve never done a squash before so it was a good learning opportunity.

While my code base was small there are always things to improve, I moved several file related functions into their own module. Then I simplified the way global variables were created by using a function, and reduced some code duplication when making calls with Ollama.

Each change was made in a separate commit, which was then squashed together into a single commit, the process was not as complicated as I expected. Then it was merged into the main branch.

That was all for this week, see you next week!

Please follow and like us:
Pin Share