I focus on making each class serving only one purpose, removing redundant codes, and avoid using global variables.
Removing redundant codes and splitting codes
JssgApplication serves as a starting file for the application but it had a function runwithconfig() whose main responsibility is different from the class’s purpose. Runwithconfig() is to parse Json and convert the Html file (this responsibility is duplicate with others’ codes). To make it a single purpose, I created another JSonUtil class to support parsing Json and making some small modifications in the run() so that still can perform the functionalities of runwithconfig() but also reusing the old codes.
After that, I remove runwithconfig().
Avoid using global variables and functions
I made all of my utils file static so that other classes can easily access them. However, considering the scalability and stability, static breaks the encapsulation and it isn’t a good OOP design. Therefore, I removed all of the static variables.
I tried to group commits by using
git rebase and it helped to merge all of the previous commits into one. My history looks much cleaner. Then I
git --amend to edit my top-level commit to a more meaningful message. After that, I switch to my
mainand merge the
refactoring branch to my main.