DEV Community

Add00
Add00

Posted on

Refactor a code factor

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!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay