Embarking on a substantial map application project involving approximately 5,000 lines of JavaScript, I am contemplating changing my approach to file organization. Traditionally, I would consolidate all code into a single file named 'main.js', but now I am considering distributing components across multiple JavaScript files for improved organization. Is this a wise decision for a more structured project layout?
I am seeking advice on the best practices for this new approach. How do I determine when a piece of code should be separated into its own file? Are there any guidelines or rules of thumb to follow when making this decision?