3 ms·
At each extreme: A source code file with very few lines will mean more cognitive load is required to remember which file (or package) some functionality is, an
by rgoulter 4y ago
At each extreme:
A source code file with very few lines will mean more cognitive load is required to remember which file (or package) some functionality is, and likely more effort to maintain the code.
Whereas, source code files which are very large mean more cognitive effort to remember where in the file some function is. In many languages, variables can be local to a file, which means use of such variables is riskier, etc.
It may be desirable to combine smaller files into a more coherent whole, or to split up an overly complicated large file into several smaller files.
Sure, without seeing code, I don't think you can come up with a concrete rule which exists in all cases. Rules of thumb can still be useful as an indication of maintenance effort.