What's the downside of using too much JavaScript?

What are some downside using to many JavaScripts in a website?

  • HTTP overhead
  • Low maintainability

Why will you use MooTools or jQuery for that project?

There are specific frameworks out there for specific things--Take Ext JS for example, which tries to encompass everything a site needs. This is not what jQuery does.


It will depend on the browser (and back end) and how it performs /scales to many scripts. When developing a solution think about the audience's requirements first. Are they going to be running quad core monsters on super fast fibre optic links or small phones with a GPRS links. Then decide what technologies will fill those needs.

Don't start from the technology first.


From your question, a couple of issues come to mind:

  • Having a lot of little script files can be a performance problem. If you're going to use a lot of different scripts, combine them into one script file (and minify it and serve it with gzip compression). There's a tip related to this on the unofficial Prototype & script.aculo.us wiki (disclosure: I mostly wrote that tip, but with a lot of input from smarter people). Also look at whether you can leverage CDNs (most frameworks are now available via the Google CDN, for instance).
  • Having lots of different frameworks (jQuery, Prototype, MooTools, YUI, etc.) in the same site can become a skills issue -- anyone working on the site will need to have skills in various different frameworks.
  • Some frameworks are incompatible with one another (for instance, I doubt Prototype and MooTools can currently co-exist on a page; jQuery and Prototype can via jQuery's "no conflict" mode).

In terms of choosing a single framework, look at what you're trying to do -- some frameworks will better suit some sites than others. Also look at the skillsets your developers already have, as the less new stuff they have to learn, the more time they can spend building your site. Look at the community around the framework. Consider the availability of plug-ins (although there are a lot of low-quality plug-ins out there; don't judge by quantity alone). Look at whether the API of the framework sits well with your approach to things.