More Modules or More Lines?

I don’t know if this is the right category for this question but is more modules better than more lines? Because I’ve seen devs have like 1 function in their module script and there’s a lot of function so there’s like a lot of modules. What is your opinion? :thinking:

More modules, period. Modules are just lines, but you always want to follow the DRY principal (Don’t Repeat Yourself), keep your code dry. Modules help you do that by allowing you to reuse code, so that when you need to change it, it errors, then it’s easy, and it reduces lines. Large code is never a good thing unless it’s optimized, or you just want to show off how much you’ve done.

1 Like

Does your module need to be accessed by multiple places? Make a module then. It could also be worth making modules for large pieces of code that are relatively isolated from the rest of the script, but you should not overdue module # as having a ton of unnecessary modules ends up being cumbersome to navigate; you don’t need a separate module for every utility function, for example. I wouldn’t say either is better or worse than the other as long as the code is readable and following the DRY principle as stated above.