views:

45852

answers:

34

There are a few JavaScript frameworks/toolsets out there, such as:

It certainly seems that jQuery is ascendant in terms of mindshare at the moment. For example, Microsoft (ASP.NET MVC) and Nokia will use it. I also found this performance comparison of Dojo, jQuery, MooTools and Prototype (Edit: Updated Comparison), which looks highly favourable to Dojo and jQuery.

Now my previous experience with JavaScript has been the old school HTML + JavaScript most of us have done and RIA frameworks like Google Web Toolkit ("GWT") and Ext-GWT, which were a fairly low-stress entry into the Ajax world for someone from a Java background, such as myself.

But, after all this, I find myself leaning towards the more PHP + Ajax type solution, which just seems that much more lightweight.

So I've been looking into jQuery and I really like its use of commands, the use of fluent interfaces and method chaining, its cross-browser CSS selector superset, the fact that it's lightweight and extensible, the brevity of the syntax, unobtrusive JavaScript and the plug-in framework. Now obviously many of these aren't unique to jQuery but on the basis that some things are greater than their sum of parts, it just seems that it all fits together and works well.

So jQuery seems to have a lot going for it and it looks to the frontrunner for what I choose to concentrate on. Is there anything else I should be aware of or any particular reasons not to choose it or to choose something else?

EDIT: I just wanted to add this trend comparison of JavaScript frameworks.

+5  A: 

I'm using YUI for a few of their controls (DataTable, Paginator, TabView, Autocomplete, etc.) since they work out of the box with very little coding. But for most everything else I rely on jQuery for it's simplicity.

I'm hoping in the future jQuery will have an equivalent set of controls so I can stick to a single framework.

Todd Smith
+19  A: 
  • YUI for a complete, professional looking, enterprise oriented widget toolkit.
  • Prototype if you are using http://script.aculo.us/ or like the Ruby way of doing things.
  • jQuery has gotten very popular and is most probably your best bet if you code in ASP.NET
  • You can't go wrong with either Dojo or MooTools
Glenn
You can easily switch JQuery into Prototype if you are using Rails
Toby Hede
I would personally switch the other way around (prototype to jQuery)
Pim Jager
YUI is worth a try if you're looking for something different (I believe LinkedIn use it).
Ross
What do you mean by 'enterprise oriented'?
SolutionYogi
Widgets that are enterprise friendly. You know, more about tree views, calendar controls, data grids, and charts than about animating sprites. Since my original post, Yahoo has been enhancing their YUI to be more consumer friendly too. There is now a file uploader, image cropper, and an image carousel widget that are all currently in beta.
Glenn
What's the connection between jQuery and ASP.NET?
NealWalters
The short answer is that jQuery comes standard with ASP.NET MVC so it is interpreted by .NET developers as being approved by Microsoft.
Glenn
+85  A: 
Eugene Lazutkin
Dojo is an excellent base for building your own code. jQuery is okay for doing some "standard" things, but when you need very customized UI widgets or other magic, Dojo's functionality is much easier to extend. It also seems a lot of Dojo's codebase is much higher quality than some components in other libraries.
Jani Hartikainen
Right on the money. For us, developers, Dojo is above all the programmer's framework. We are striving to provide a solid foundation for custom development, and we work hard on improving Dojo's code as much as we can. I hope it shows.
Eugene Lazutkin
The problem with Dojo is the documentation. It's not unified (dojotoolkit, dojocampus, sitepen), dojotookit.org is painfully slow, the forum is deprecated at the moment, and personally, I've had poor luck on the irc channel....
sprugman
Working with different toolkits I found that Dojo's docs are not that bad. For example, I have to dive in jQuery's source code on daily basis.Official docs are on dojocampus.org --- no need to go elsewhere. IRC is always about catching right people online. ;-) Sitepen doesn't provide Dojo docs, but it has good articles on Dojo, and you can find more if you google around.The forum was deprecated for a reason --- there is very much alive [email protected] mailing list. If you prefer a web interface, use Nabble or Gmane to read/write. Try it.
Eugene Lazutkin
I recently subscribed to the mailing list, and I have to agree (despite my statement above), that it seems to be a vibrant and helpful community.
sprugman
While I may not be convinced about components outside of the code, I definitely agree that Dojo is a superior framework for building large scale applications; so much so that frameworks such as jQuery, Prototype and the others (possibly excluding ExtJs) seem like jokes. I never use jQuery for more than progressive enhancements.
Justin Johnson
i love dojo's OOP approach but i laughed outloud at the bit about the community... the dojo forums are painfully slow and no one responds to questions that you have there. they recommend you then go on irc just to get your question answered, yet noone responds on irc either. if you're ok with being on your own when something goes wrong than maybe dojo is fine, otherwise stick to something that has much better support like jquery.
Justin
@Justin - what dojo forums? use the mailing lists (this option was available forever), and (oh irony!) you can use Stack Overflow. ;-)
Eugene Lazutkin
I've used both jQuery and Dojo extensively, and I love jQuery much more, because it's core functionality is far more intuitive.
Mark Rogers
@Mark Rogers: Fair enough. Working with jQuery even more than I work with Dojo I have a different opinion. Care to elaborate, e.g., write to me directly and I will share your views with the core Dojo developers? If you want, I can share your opinion anonymously. Don't forget to mention what version of jq and dojo you compared.
Eugene Lazutkin
+5  A: 

I think you might find jQuery is rapidly catching up on the plug-ins front.

Gray Gaffer
+181  A: 

jQuery

  • Fast
  • Well documented
  • Easy to use
  • Chaining
  • Unlike Prototype it doesn't extend an object if you didn't specifically ask for it (try looping an array in Prototype)
  • easy-to-use Ajax (I love the $.ajaxSetup() function)
  • Nice event handlers
  • CSS selectors
  • filtering your selection
  • did I mention chaining?
  • Small (only 30 KB)
  • Nice little build-in effects.
  • Plugins
Pim Jager
We use jQuery here on StackOverflow - and if you run into a tricky problem, its creator might help out! http://stackoverflow.com/users/6524/john-resig
Jarrod Dixon
jQuery is great, and I usually use it, but it's just "best" for every situation. In some situations, prototype is nicer.
TM
If it's good enough for SO then it's good enough for me also. (I'm sucking up, if you want to give me +20000 rep then I'll be fine with it).
Lucas McCoy
jQuery all the way. Fast. Lightweight. Easy. Powerful. It has it all.
Jeff Davis
+29! Now that's fanboyism!
alamar
+1 just for their documentation alone. I wish it had more UI control (there is a Calendar, Tab Control, dialog, etc), but nothing like what YUI has. But YUI doesn't do all the things that JQuery does either -- and there are plenty of plugins.
Chris Brandsma
It is a masterstroke to use CSS selectors. This means that if you already know CSS, you have a good headstart. If you don't know CSS and start using jQuery, you automatically learn CSS. Not to mention that CSS selectors make code very concise.
SolutionYogi
One gotcha in jQuery is it depends on how you want/need to use it. While jQuery-UI is nice, it does have a couple drawbacks. Using it in a full-window application is much more complex than say extjs. There are a few grid implementations each with their own drawbacks, and creating iframe based containers is cumbersome. That said, I've written a few jQuery extensions, and really like it a lot. I would suggest extjs if you need a full application-like UI, otherwise jQuery.
Tracker1
I disagree. Prototype is architect-ed with better syntax and build for scalability - http://blog.thinkrelevance.com/2009/1/12/why-i-still-prefer-prototype-to-jquery
JONYC
Yay, made it >100 upvotes =D
Pim Jager
@JONYC - Even some of the prototype authors regret the architecture because of the conflicts it causes (you never know what the spec adds next), Prototype 2.0 *won't* extend the DOM. This is from Kagnax on the [Prototype core team](http://www.prototypejs.org/core): http://perfectionkills.com/whats-wrong-with-extending-the-dom/
Nick Craver
_try looping an array in Prototype_ - You're looping it wrong! `for..in` isn't even called looping, it is _enumerating_ over the keys.
Chetan Sastry
+4  A: 

If you are doing anything really JavaScript-heavy, like a single-page site I would say Dojo, because of its great architecture, templates, widget-system and built in widgets for pretty much everything. Otherwise, if you need a more lightweight style, I would say jQuery :)

finpingvin
+5  A: 

I use YUI because I think it is complete in functionality.

The YUI 3.0 will be very like jQuery in its strengthness.

Daniel Silveira
+11  A: 

One thing is nobody seems to have mentioned that you can use more then one library, the MochiKit library in particular, since in terms of name spacing I think it is very well designed. I guess the MochiKit library isn't very popular it is a shame because I think it is hands down the most well designed as a JavaScript library. http://mochikit.com/

I prefer the YUI of all the things mentioned though because not only is it a well designed JavaScript library that doesn't interfere with your code because everything is in YAHOO or wrapped in an anonymous function, but also it has a very clear focus to the library and it fits in with the philosophy of MVC.

+5  A: 

I have to add something for consideration.

Prototype's API documentation rocks. http://prototypejs.org/api

jQuery's documentation sucks, frankly. I mean, just compare those! http://docs.jquery.com/Main_Page

Also, Script.aculo.us is a known value. I can't say it's technically the best, since all frameworks have something comparable, but who on earth cares about "technically the best"? You don't. I don't, either.

alamar
I do not agree, I like jQuery's documentation very much. I find it very clear, especially the examples and the way it is split up in what you wan't to do with it (instead of in the different Objects as prototype's).
Pim Jager
agree 100%see http://api.jquery.com/
adardesign
http://api.prototypejs.org is the new location of the api documentation.
Thorpe Obazee
And it SUCKS a big time, so I recommend everyone to bookmark http://prototypejs.org/api
alamar
@alama: I used to agree with you, but jQuery is not so famous that I found another version of the api: same contents, but much better to use: http://www.jqapi.com/
Marco Demajo
A: 

I have recently started using GQuery (jQuery port for GWT) and it seems to be the best thing that happened to me after Krispy Kreme doughnuts :)

I am a java developer so there is a bias for this framework. The other reason why I recommend it is for the performance. Check out the GQuery vs jQuery performance comparison at http://letusdemo.appspot.com/ I uploaded a demo by Ray Cromwell.

Drunken Programmer
GQuery is cool. But that performance comparison is old. jQuery 1.2.3! I'd love to see an update. Also, does GQuery keep up with changes that get made to jQuery?
Nosredna
I will work on the weekend to update the demo to do a comp with the current jQuery build. Its still build 1.0 and is being worked on by just 2 ppl so I really dont know how the update process is going to be. But if it gives any comfort the 1.0 was released on May 29th. I think it ported jQuery as of then.
Drunken Programmer
A: 

JQuery + SmartClient

I believe SmartClient officially supports comingling with JQuery on the same page. (http://forums.smartclient.com/showthread.php?t=3578&highlight=jquery)

So use JQuery for basic stuff, and insert heavy-hitting application-like widgets via SmartClient.

Eric
+3  A: 

I like jQuery simply because it's well documented! There's an excellent jQuery book: "Learning jQuery1.3" Chaffler/Swedberg.

ראובן
+11  A: 

With the exception of Dojo/YUI most of these are libraries, not frameworks. Frameworks involve a little more (architecture + development tools).

JavaScriptMVC (http://javascriptmvc.com) is a great choice for organizing and developing a large scale JS application.

The architecture design very well thought out. There are 4 things you will ever do with JavaScript:

  1. Respond to an event
  2. Request Data / Manipulate Services (Ajax)
  3. Add domain specific information to the ajax response.
  4. Update the DOM

JMVC splits these into the Model, View, Controller pattern.

First, and probably the most important advantage, is the Controller. Controllers use event delegation, so instead of attaching events, you simply create rules for your page. They also use the name of the Controller to limit the scope of what the controller works on. This makes your code deterministic, meaning if you see an event happen in a '#todos' element you know there has to be a todos controller.

$.Controller.extend('TodosController',{
   'click' : function(el, ev){ ... },
   '.delete mouseover': function(el, ev){ ...}
   '.drag draginit' : function(el, ev, drag){ ...}
})

Next comes the model. JMVC provides a powerful Class and basic model that lets you quickly organize Ajax functionality (#2) and wrap the data with domain specific functionality (#3). When complete, you can use models from your controller like:

Todo.findAll({after: new Date()}, myCallbackFunction);

Finally, once your todos come back, you have to display them (#4). This is where you use JMVC's view.

'.show click' : function(el, ev){ 
   Todo.findAll({after: new Date()}, this.callback('list'));
},
list : function(todos){
   $('#todos').html( this.view(todos));
}

In 'views/todos/list.ejs'

<% for(var i =0; i < this.length; i++){ %>
   <label><%= this[i].description %></label>
<%}%>

JMVC provides a lot more than architecture. It helps you in ever part of the development cycle with:

  • Code generators
  • Integrated Browser, Selenium, and Rhino Testing
  • Documentation
  • Script compression
  • Error reporting
Justin Meyer
+1  A: 

Another option is SproutCore.

Right now it seems that they might still be too young (e.g. underdeveloped widget/plugin libraries, lacking documentation) to seriously compete with the big players, but I've never used them. It looks like a MVC framework with some potential.

It seems they got a nice visual style (Apple used them), though I wonder how easy it is to skin/brand. (One of the worst things about Ext is how you can easily identify any Ext app in about half a second).

dmh
+12  A: 

How about some love for Ext JS? (Or should I write, sencha?)

Upper Stage
Scared off several times by the license, which is more restrictive than any of the others.
Nosredna
Fair enough; I wonder whether others are similarly discouraged...
Upper Stage
I don't know. I'll probably try it out someday.
Nosredna
My typical client is not discouraged by the cost, typically prefers more a conservative look-and-feel (grids, trees, border layout, etc.), and hires large teams of developers new to JS. I find ExtJS is a reasonable solution in these circumstances.
Upper Stage
I agree, i love being able to lay things out without using (sucky) html/css layout.
Igor Zevaka
I find for full-window applications ExtJS (maybe Dojo) is best. For multi-page apps/sites that need some Ajaxy integrations, then jQuery+UI or prototype/scriptaculous is better. I think that as a DOM extension and dhtml toolkit that jQuery is better in some scenarios. I like ExtJS a lot as well. I'm currently working on a large project using it under a commercial license. Worth noting that it doesn't make IE6 happy at all.
Tracker1
I am exploring Ext JS. Here is where I stand in my assessment so far:<<PROs>>:Productivity, Architecture, Widgets, Extensibility, Support, Community, Documentation<<CONs>>:Licensing / Pricing, Huge JS footprint, Huge CSS footprint, Looks more intranet inclined
Kabeer
@Kabeer - I agree with your assessment.
Upper Stage
@Kabeer: +1 interesting point.
Marco Demajo
A: 

I definitely recommend the use of both jQuery for all the reasons listed above, and YUI for the out of the box elements.

You can't go wrong using those!

Of course I am sure some other frameworks (Dojo, Prototyp,... ) are good too.

After it's all a matter of taste and of efficiency.

Tom
+4  A: 

Since this question is a bit old, I thought I'd point out that there are new kids in town to consider:

Not as new, but previously unmentioned in this thread:

Nosredna
+1  A: 

I use jQuery because there exists a goos integration into my standard web framework struts2 and it is easy to extend.

See http://code.google.com/p/struts2-jquery

Mark
+3  A: 

I would say that the main question to ask is:

Are you doing small scale website additions or large single page web applications?

Any of the libraries are good for the former, but for the latter I would choose dojo every time. The reason being:

  • its excellent widget system
  • its breadth of functionality
  • its build/minification system
  • its easy extensibility and robust OO design

but most importantly

the fact you have a single source for the toolkit and widgets that are on a defined release schedule with a published roadmap and a large number of people working to make each release happen. This is invaluable for large scale development. I would hate to be in the position of using toolkit X for xhr and dom manipulation, but toolkit Y for some widgets and toolkit Z for other widgets. Trying to get compatibility and synchronized releases would be a non starter. Find out how many people support and maintain your toolkit of choice and work through the scenario of what you would do if the maintainers left to do something else..

Andy
This is an excellent point, we use Dojo at work, and its still a pain to upgrade just Dojo alone, I can't image managing and upgrading multiple toolkit/widgets libraries!
Pharaun
+1  A: 

The trends comparison has a typo. Here is updated link to trends for last 12 months.

Interesting post and question. I'm open to different libraries but tend to use jQuery because:

  • I find I'm very efficient coding in it
  • the documentation is good
  • it's fast and not very buggy across browsers
  • it is actively being developed
  • it has a good community both in terms of conversation and plugin development
heyyeah
+7  A: 

A new kid on the block: http://ukijs.org Its strength is dealing with enormous lists. IE6+.

Julian
+1 Uki's Google Wave layout in 100 lines of code is pretty impressive, I must admit.
cletus
Anyone done a head-to-head on Uki vs Dojo / JQuery UI etc? It'd be interesting to see how they fare.
Julian
A: 

Jquery is technically the best...

if you consider that speed, documentation, and browser support as the measuring points.

orokusaki
There is no good and bad, it depends.... What works best for you may not be the best for someone else.
Script Runner
@Script Runner - Cletus: "What's better; A 2010 Ferrari, or a 1972 Honda?", Me: "A 2010 Ferrari.", Script Runner: "There is no good and bad...some worthless banter...".
orokusaki
What is best depends what parameters you're measuring on. orokusaki has said which parameters (s)he's using to measure, so saying "There's no good and bad, it depends" is not an appropriate response.
TRiG
@TRiG - thanks. I'm glad there's somebody who read the whole answer before blindly down-voting.
orokusaki
@orokusaki: it's the best until you decide to look in its source code.
Marco Demajo
@Marco - what do you mean? It seems to be really well written, considering the monstrosity that is JavaScript. What portions are you referring to, specifically?
orokusaki
@orokusaki: I mean that I'm not smart enough to understad the code inside of it. Reading through a piece of jQuery code takes me twice the time reading throught a similar piece of YUI2 code or Prototype. If something does not work in a library I would like to be able to fix it by myself, I can't wait for the developer to fix it for me in his spare time.
Marco Demajo
+1  A: 

Everybody talks about various JavaScript libraries and how cool one is vs. the other. How many developers really think about the bottomline impactfor their clients/employers????

In our analysis, we found that if you were to build a typical browser-based, serious business application using any of the frameworks/libraries mentioned above, you are likely to have an army of developers developing things in mostly inconsistent manner unless you have an army of code-reviewers/architects who understand how to achieve good modeling in JavaScript-based applications.

And even if you used best of what is available today, it is likely to be outdated in a matter of months if not weeks because landscape is changing so fast. Why is everyone getting so excited about coding JavaScript code to design some cool looking ui, but not even asking where are IDEs that once existed 15/20 years ago?? Does anyone even know/understand what I am talking about? Why are we coding same solutions again and again, instead of drag and drop IDE and the productivity that can be achieved with it?

At end of the day, what matters to the business is a quality, usable business solution that can deliver a lasting solution for years (not months or quarters!)

Finally, coming to the point, after thorough research we settled on General Interface (http://www.generalinterface.org) - originally from Tibco and now donated to the Dojo foundation. It is not the most ideal solution for creating s3xy Ui, but provides pretty good options for creating a meaningful business application.

If you haven't looked at it yet, building little more than s3xy websites, and have a capability to understand the business perspective (along with technical maturity_), then do explore this! You might be pleasantly surprised.

Your Friend
Reads like an ad.
Wahnfrieden
Look at the programmers/dev who are still using VIM and Emacs, IDE can provide some features and functionality, but they are not "The last word" in computering you know. Deep knowledge of the limits and abilities of the said language under development, well constructed testing plans and well designed pages will trump IDE any days honestly.
Pharaun
+1  A: 

I am new to DOJO and so far I hate it. I had a hard time to find a good forum. I went to http://o.dojotoolkit.org/forum but it's obsolete. Searched on Google for hours and haven't found a good one. Could anyone point me to the right DOJO forum?

We are using Spring Faces which uses DOJO as its back end. Therefor we want to use DOJO for the rest of our normal Javascript tasks. However, if it's difficult to find support and documents for DOJO, we will have to switch to jQuery.

Thanks,

Fantabk

Ha
You hit Dojo in the middle of its site redesign. Try http://dojotoolkit.org/community or /documentation
peller
+2  A: 

To learn Dojo go to dojocampus.org. It is the best place to see it in action and learn!

Aveesh
+1  A: 

hey cletus,

i know its late answer but bit worth for your question..

http://mootools.net/slickspeed/

the link above tested the speed performance and finalized Dojo and next jQuery .

i have always go with jQuery but just for ur info and i wonder this speed test was done by mootool website :).

Thanxs, Gobi.

Gobi
A: 

I have to agree with another post, re: a user-friendly fast visual IDE. It'd be really, really great to have a decent JavaScript debugger built in as well.

Also, how about a JavaScript framework with strongly typed variables and real OO structures? That would surely make the transition to JavaScript development a lot less painful for some of us used to a more, shall we say, rigorous programming environment.

bennett
+3  A: 

In my experience, everytime I saw that first of all Javascript provides a kind of freedom which makes possibile to do everything you want, in every way you want, and that is not the best at all.

I say this as a preface because I think that jQuery is powerful and cool, but let developers to do things in a "quick and dirty" way. My tiny poreface was about this, generally developers makes dirty dirty things in javascript, which tends to became dirty a lot, difficult to mantain and last but not least, difficult to understand!

I used ExtJs and I really love it because it helps to do things in a better way, more structurated, well designed and based on good principles, OOP too, Fine OOP.

I our project when we abandoned ExtJs to go to jQuery we loose all the good designed scripts, easy to read and to understand, and we earned just "quick and dirty" things!

So at the end I can say:

  • If you want to make things well, clean, elegant and more.. the choise is ExtJs
  • If you want, or need to do things quick as possible then use jQuery

p.s.

The fact that Microsoft adopted jQuery it's not well as it could seems about using or not jQuery ;-)

Hoghweed
A: 

I will choose JQuery, it is light weight ,easy to use, chaining method

Eric Json
+1  A: 

jQuery. Never let me down from the smallest projects to the largest.

Matt Williamson
A: 

For media type of websites, jQuery rules, for heavy RIA Ajax apps, the other framework offer a lot of out of the box widgets, however at a cost, and if you do little work you can accomplish the same with jQuery... plus if you are a guru JS developer, jQuery gives you more "row control" over what's going on on the page...

Dave
+2  A: 

I hate them all!

Because I like coding everything from scratch in Rambo's way of doing things!

And now listen to this question: John Rambo vs John Resig, which one of these frameworks do you prefer?

Marco Demajo
A: 

Ultimately, it will depend on your project's requirements, your team, your testing methods, and your audience.

jQuery was my first library, and I learned a lot about the language from reading that source code. But, when working on mobile apps, I don't bother with jQuery since most of the weight is resolving cross-browser issues. If your team needs modules and unit tests in namespaces (yadda, yadda, yadda) you may want to look at YUI or ExtJS/Sencha.

The team has to learn it too. jQuery has a lot of good docs and community support. ExtJS is powerful, but heavily relies on object literals with tons of options to control behaviour--something foreign to some programmers.

Regardless, try to pick one library per project.

AutoSponge
+2  A: 

For a lasting, high quality, bulletproof (or as close as possible) product, you need to be able to do unit and integration tests. jQuery, Dojo, MooTools, and YUI have testing capabilities; not sure about the others. jQuery's testing toolkit is like giving crayons to a painter; sure they can use it, but it doesn't quite do the job. I haven't used Dojo or MooTools testing so I can't really comment on that. YUI's testing toolkit is very nice and I have been using it for a couple of months now.

I have been using jQuery for years now and find that when your project gets to a certain size, code management and resolving bugs gets pretty hard and have been looking for a new tool. Yahoo has done an excellent job and created a solid testing toolkit. It doesn't pollute the global namespace and its results can be read by JUnit and Selenium. Also, the syntax is very friendly to any xUnit user.

As for widgets and the like, YUI does a good job, but Dojo and MooTools both have extensive plugins and widget support from large communities. Dojo integrates extremely well with the DOM, but MooTools and YUI are strong there too.

All in all, I think Dojo, MooTools and YUI are great frameworks, the way you like to code will determine what you use. I'll stay with YUI for now.

Scott