Introduction
As usual, my assignment this week is to keep improving my code's readability. In my previous commits, I always keeps all my functions under one entry point file. As a result, it would be such a struggle for me and other to maintain and understand my code efficiently.
What I do
Improvements
I am fully aware of the inconvenience that I would end up if I don't make any improvements. So there are some changes:
Move all functions to separate helper files
- All functions working with URLs will be moved to an URLs helper file.
- All functions interacting with files will be moved to an fileInteraction file.
Whenever I feel like using any of these functions above I would easily import it from the files. Therefore, my code structure would be way more organized and easier to maintain if there is any problem.
Reduce code duplication
- All blocks of code that is used multiple times will be convert into a function. So, I can reuse them without rewriting them over again.
Squash all commits into one by using git rebase
Difficulties
- Sometimes we will be in trouble if I forget to import the functions after separating them since all of them are tightly connected to each other. By which, I mean fileInteraction functions sometimes call URL helper functions and we have to import them properly in order to make our app run smoothly.
Conclusion
Knowing what to do to enhance your code performance could give you chill. However, I know so clearly that my work is still flawed and I am more than welcome if any one can suggest any improvements I could make. You could check my latest commit at c22a005.
Top comments (0)