tags:

views:

491

answers:

5

I am an avid user of the YUI framework (http://developer.yahoo.com/yui/). It has its' strengths and weaknesses both performance wise and syntax wise. I have seen a bit of JQuery and I have worked a little with prototype as well but I have stuck mainly to YUI. My question is, is it better to stick with one Javascript library per application, or leverage the abilities of multiple javascript frameworks in your application?

+15  A: 

I think it is better to use one framework for at least two reasons:
1. Code is easy to maintain because there is no syntax mix.
2. Application loads a little faster and I think should execute little faster.

Jenea
Also, easy to ask for help on forums. You may have to debug your code by yourself if you use a mix of them.
krishna
Thanks! I had never considered that angle. Asking for others help is definitely easier if you have less variables to deal with
Zoidberg
Elaborating on Jenea's second point, using a single framework = less bytes to load as you only need to download a single framework's JavaScript resources. More frameworks = More JS = More download time + more browser initialization time (since most JS frameworks have code that must be processed on page load).
Todd
+1  A: 

My guess is that multiple frameworks is better as long as each has its purpose. If I'm building an ASP.Net web application with AJAX functionality, there may be some built-in ASP.Net AJAX Javascript libraries being used automatically that can be combined with JQuery to handle some situations. Alternatively, one could have third-party controls like Telerik's RAD controls that also bring in more Javascript code possibly. The key is to understand what each framework is adding in terms of rolling your own.

JB King
To clarify, the Telerik RadControls do not use or load a proprietary JavaScript framework. They build natively on the Microsoft Ajax libraries and jQuery. The controls, of course, load JS to provide their richness, but the underlying frameworks are standard.
Todd
How close do the Telerik controls come to being a framework or are they not viewed from that perspective? I'm asking this as an honest question of where is the line for how much code does it take for something to be a framework, that's all.
JB King
A: 

Sure less frameworks in the same website will make your life easier, so try as you can to use one framework, and if you are going to use more than one, take care from conflicts and redundancy.

If i am in your place, i will start searching the framework i have for some plugins and updates, if didn't find will add the new framework.

One more point: don't panic from using more than one framework, the big and famous frameworks such as jquery has its implementations to solve conflicts and work side by side with other javascript libraries

Amr ElGarhy
Yes, YUI version 3 will be designed so it stays completely seperate from any other javascript libraries out there. I would agree with the answer given that currently its probably a good idea to keep frameworks seperate, but it seems like more and more libraries are being upgraded to allow developers to use multiple libraries in the same app. So we'll see as these newer versions come out if using two or more libraries remains a bad idea.
Zoidberg
Sometimes plugins are as big as another library. I think there may be times where it's worth it to bring in another library which has cleanly implemented a feature that you otherwise need a plugin for.
Nosredna
A: 

Also... if you use 2 diffrent frameworks at the same time, some functions in one framework could override an function in the other framework, and make ugly conflicts.. e.g the $() could be implemented in diffrent ways, and make something crash, if other functions of the framework is using it. (and they sure do!)

PHP_Jedi
thats why jquery has compatibility mode
Matt Briggs
A: 

I think its better to use 1 framework in your development, for consistency of API and loading speed. the problem sometime is no framework is comprehensive enough to have all of our development needs. This is just came into mailbox, their ad say it's a comprehensive framework, with plenty of widget: grid with grouping, charts, forms, tab, fields and so. I haven't play it long, but it seems very promising. check http://www.intelligentexpert.net

mity