Proposal: Reorganize folder structure of /Assets/Scripts
Purpose: Make the codebase more navigable and improve organization. Compartmentalize all the things. Keep various realms of code properly separated to avoid having messy code as the codebase matures.
Risk: Low risk in the majority of cases i think since no code is actually being modified.
This is an entry from nuke's code janitorial list of proposals
_"for your health!"_
Start with 4 broad categories as folders (assume we are using Scripts as the root folder):
Station subfolders
Entities subfolders
As a rule of thumb you should be able to pick a folder at random in the Scripts folder and you'd be able to figure out which of these folders it belongs in. If not, then it might need to be handled on a case by case basis or maybe would need to examine the folders that could not be categorized and see if there's a missing category.
You might also be able to argue that the categories be done in a different way, i'm all ears.
There's also a chance that there's a bit of intermingling of concepts. As a purely hypothetical example, say that a lot of job-specific code were inside of the Electricity folder, which would mean the folder wouldn't perfectly fit into Modules or Jobs since it's a smoothie of different things. To me this would be a red flag, keeping the job-specific code and the system-specific code separate would be important as far as organizing the codebase is concerned. So in some cases there may possibly be a bit of refactoring/separating of concepts to do... But my hope is that this would be an exception to the rule. I am still getting accustomed to the codebase so i'll defer to someone with more intimate knowledge of it.
If this proposal were to be broadly agreed upon then i would be ready to start work on it whenever it's approved.
Yeah, scripts folder reorganisation would be very nice indeed – especially the UI section that is a mess
A few other thoughts off the top of my head:
Also this would need to be coordinated with contributors currently modifying scripts – perhaps a 1-2 day script freeze would be appropriate. And other pending PRs would have to be merged and closed before that
we also need to migrate some stuff to the packages folder,
stuff that's not dependent in anything scripts like logger,
since if they're in the packages folder they don't get recompiled all the time
Perhaps calling the I see you've updated the OP. Neat!Objects folder Entities or some-such might be more appropriate, and rename Stationary to Objects. I think it would fit in more with how they are referenced elsewhere.
I'll update the OP with that, makes sense to me.
I was thinking about how badly this would impact other contributors, you'd definitely need a code freeze for a short duration. I think this change could probably be done relatively quickly in an afternoon (the broad strokes anyways - if there were refactoring to do it could be saved for last after the major reshuffling has been done and wouldn't require the code freeze really)
I think it would be best to do it after we push the next build, a new build hasn't come in ages because the builds kept breaking and we've only managed to push them to staging recently. If we fix the nasty bugs and the maps, then push it, contributors and players wouldn't mind if you moved all the code around into their new folders.
Maybe if it syncs up well with the new build it could be done immediately after the build is published since i'm sure there will be an effort to close out a bunch of features for said build. So it would put the project in a good place for a very brief code freeze.
Most helpful comment
I think it would be best to do it after we push the next build, a new build hasn't come in ages because the builds kept breaking and we've only managed to push them to staging recently. If we fix the nasty bugs and the maps, then push it, contributors and players wouldn't mind if you moved all the code around into their new folders.