osu-ahr
osu-ahr copied to clipboard
Moving classes into individual files
Requesting an idea. There are two (or possibly more) classes in a single file that I saw.
LobbyKeeper
for example, which also has another class inside it called SlotKeeper
, and possibly more on the other different class files.
https://github.com/Meowhal/osu-ahr/blob/24f3b18bb6caa6d0ca03354fbf3caf6570b6605c/src/plugins/LobbyKeeper.ts#L49-L485
https://github.com/Meowhal/osu-ahr/blob/24f3b18bb6caa6d0ca03354fbf3caf6570b6605c/src/plugins/LobbyKeeper.ts#L487-L604
While there is no problem with this at all, like classes that are small that doesn't need to be in a new file, this is still refactorable, I think one class per file, moving all classes into their own files makes it look neat, organized, less difficult to find(to potential future readers), and could probably help a bit on debugging as well.
This doesn't have to be done right away.
I would have preferred to keep SlotKeeper as a private class and not be aware of it from the outside, but I had to make it a public class in order to write tests. You are right, SlotKeeper is large enough to separate file. However, it seems odd to have a non-plugin SlotKeeper.ts in the Plugins folder. (Please don't mention VoteCounter.) I am considering creating a subfolder for each plugins in the plugin folder