The thing is that I have a very large JS file, with more than 5.000 lines of code, which holds several objects (some inherit from others), functions and so on.
but if you try to find something, you need much time, because it is so big and my IDE (Netbeans) does not really represent it clearly enough.
I.e. the navigation does not support JS very well, and merges variables with same names, although they are local vars and occure in different objects.
I don’t really want to split it into many files (i.e. for each object one), because I have to merge them again on the live server.
how do you structure your JS files?
have you found a well naming scheme or something?
UPDATE:
So far I found, that splitting into many files is a good idea… How do you name your files? how do u organzie them?
My setup has separate files for each object. This is ideal for me because it makes finding things very easy.
It’s also very easy to have a simple ‘build’ script that concatenates all the files together in the proper order. I also have my script run the concatenated file through the Closure Compiler which makes an unreadable mess, but compacts my scripts to about 1/3 the original size.
In my opinion, it’s worth the minimal effort of making a ‘build’ script to have all the clarity of separate files.
EDIT:
Another benefit of this is that I have two versions of my script. The concatenated ‘debug’ version that is human-readable and the minified ‘production’ version that is definitely not.
When I’m trying things out, the page links the readable version; when it goes live, the page links the minified version for faster loading (and readability is no longer important).