Well working on projects, I find myself cramming lots of functions into a single class (or module script) which leads to them being 200+ lines of code for a system that just handles the intermission and round.
So, how do you guys organize your module scripts, do you split one into a lot of little ones (ex. instead of having one large module script for a round/intermission system, would you split them into one for the events, one for the intermission, etc) also, would you have a “Handler” or “Manager” module script to handle all of the little ones, so you can simple do Round.init(...) or would you have a normal script requiring all of them.
I myself work on smaller projects, so I do not perse require the use of ModuleScripts, but I do have my ways of using them.
One example is for my dialogue system that I have worked on. I have two scripts, one of which being a ServerScript that receives Events and the such. In that script, I gather the information I need and send it to a ModuleScript. In the module, it will get reformatted and prepared for display. ‘Baking’ the code, so to say, sending it back to the ServerScript to finally display it on the screen.
You have better uses for ModuleScripts, but if I were to work on bigger projects, I would be using them to handle either calculations, repetitive codes, or filtering and/or reformatting.
In my personal opinion, modulising code just for the sake of modulisation is a bit pointless and could even cause readability and (sometimes) debugging issues. I would personally say that you should modulise code when you believe that piece of code is going to/could be used for another purpose/elsewhere in your codebase or for storing constant configuration data (i.e. animation IDs, image IDs, etc.).
It’s good to hear the community is waking up and not promoting SSA anymore. Now, the next goal is to get rid of OOP for most cases and promote other programming paradigms available.
This is a big mistake. An intermission and a round shouldn’t be a “class”, You might be using a bit too much of OOP in your projects.
It should be a main script that connects multiple files together, the behavior should be mostly functional and written in the main script, and data should come from elsewhere in an immutable format. Mutable data should be generated within the main script and processed there.
-- immutable data
local game = require(...)
local shared = require(...)
local mutableData = {};
while true do
-- you write pieces of functions to later be combined
waitForPlayers();
intermission();
teleportAllPlayers(Players:GetPlayers());
round(getRandomGameMode());
giveRewards(calculatePlayersPerformance());
end
it can be expanded to be more robust but this is just an example.