honestly I don't have experience with really large JS projects but one thing
that I think that makes a lot of difference is to have a single entry point,
it really helps to keep things organized and scalable... (from my back-end
and flash experience) - so you would have a main JS file that you include on
every single page of your site (preferably the only script tag) and this
file decides what needs to be loaded afterward... the approach that I've
been using lately is based on URLs (routing) instead of class names / ids...
(I don't like to mix logic with markup)

the advantage of having a single file that decides what needs to be
loaded/executed is that you can later add/remove as many files as you want
without editing the HTML and you can make sure things will load on the
proper order and that you have all the dependencies available (specially if
you are using something like require.js, dojo.require, YUI.use, etc) if you
are working with a larger team and/or don't have direct access to the HTML
it can make the process way easier.

another thing that helps a lot on larger projects is to keep the files as
small as possible - I try to keep mine under 100-200 lines, of course
sometimes it isn't possible... - having smaller/specialized modules (even
with cross-dependency between them) usually helps to isolate problems and to
"keep things under control".

so one module should control the URL and load the "main section module",
each section has it's own "main module" that controls dependencies and
initiates top-level modules, each top-level modules loads and initializes
the sub-level modules and so on.. - you do a chain based on what's come next
on the hierarchy, the parent takes care of it's children...

I think this post has many links that may help you:
http://addyosmani.com/blog/large-scale-jquery/

cheers.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to