DEV Community

Shaily Shah
Shaily Shah

Posted on

Lab 5 - Refactoring the code

For this lab I had to refactor the code, kind of like giving it a little makeover. The goal was to make it easier to understand and manage. First, I fixed up a function called textToHtml. I made the HTML template neater, so when someone looks at it, they won't scratch their heads in confusion. It's like tidying up a messy room.

Then, I worked on another part, the markdownToHtml function and some file stuff. I realized things were a bit scattered, so I put them into a group called FileProcessor. It's like putting all your toys in one box instead of having them scattered all over the room. It just makes things easier to find.

The main function was like the big boss overseeing everything. I broke it into smaller parts, like having different managers for different tasks. This made everything less chaotic and easier to follow.

During this process, I used something called an interactive rebase, which is like a tool to arrange things nicely. But, there were some hiccups, especially when dealing with file deletions. I had to fix conflicts and make sure everything still worked.

Testing was my buddy throughout this journey. It helped me catch potential bugs early on. The main takeaway? Keeping things neat and organized in code is like keeping your room tidyβ€”it just makes life simpler!

Top comments (0)