Multiple JS Files or Single JS File

"Maninder, Singh" <[email protected]> Mon, 27 Mar 2006 18:52:29 +0530
Newsgroups gmane.comp.web.dom.wdf
Message-ID <4D8B620F4FDA414982B23A3E7F6A8EF11AAD9E8D@hydmail01.hyd.corp.int.untd.com>
Hi Everyone,

Just wanted to take some guidance on the following- 

In my AJAX appication I have a number of js files -

1. Some are library specific and hence in different js files.
2. Some are application specific.

In case of application specific files, the only reason why I separated the js content in 3-4 files is because it is easier to maintain & makes more sense to keep them separate.
For eg: Some functions are for easy manipulations & are generic so I moved them to utils.js, some are a hash of error messages so I moved them to errorMessages.js and so on.

These 3-4 js files are not huge, they must be around 4-5KB or even less. But, they have been broken up because of the above reason.

Now coming to my question - is this is a good thing to do or a bad thing?

Pros (of having mulitple files) -
1. Easier maintainence
2. If code is updated in one file, we don't need to download the huge js (sigma of all js's) again

Cons (of having multiple files) -
1. Would the browser open 3-4 different connections for downloading them? 
Since most of my userbase is on dialup, every connection could be costly as compared to only one connection in case of 1 huge js file.

Well I have been referring to it as a huge js file but it won't actually be huge (wuld be around 30KB..but looks huge compared to 4-5KB :)

Thoughts?

Thank you,
Mandy.


Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/