Should I put everything into one Module?

To put it simple, I’m wondering if it would be better for me to put everything inside of one module, so things like camera shakes, attacks, everything. Or, should I have separate Modules for different things? I’m asking this for further knowledge on organization.

You should keep everything that are not related to each other in separate modules. Camera shakes, attacks, etc. should be kept separate since they are not associated with each other.

1 Like

I believe I saw this quote somewhere on the dev forum but I can’t quite remember it but it goes somewhat like this:

If you have to use “and” to explain what your code/script does you might want to rethink about that code.

So yeah if you put everything in one module it kinda defeats the purpose of making code modular. I believe the proper name for this design philosophy is the single responsibility principle which you can see around the dev forum and the post below and what @Noobruhdude has talked about:

1 Like

Remember that when you pass the require() function, the script gets a copy of the required module script. For this reason, you should have several distinct modules, each handling a different mechanic in your game.

1 Like