NotOneBit Blog

Get started today on your next web project with NotOneBit
We've been doing web development before you were born *

Why I Use jQuery Over YUI

With all the jQuery posts I’ve made, and all the jQuery plugin work I’ve done, it may surprise you to learn that when I started moving from coding in pure JavaScript to using a library/framework, that I started using YUI first.

A few years back, when interest in the new JavaScript libraries really started to heat up, I took a look at what was out there. The main contenders at the time were YUI, jQuery, Mootools, and Dojo. After checking them all out, testing the examples they each provided, and reading the documentation, I decided to try YUI, figuring that since it was created and used by the folks at Yahoo! that it would not only be around for a while, but that it would be high quality. And I was right. Sort of. While the quality was high, there was also a learning curve to be tackled, and it was then that I hit my first wall with YUI’s documentation.

Let me take a minute to go off on a short tangent here. I love PHP. One thing I particularly love about PHP is how simple their website is, and how easy it is to learn about any part of the language. Pick a PHP function and you can find a page on php.net devoted to just that function which clearly explains everything about it. They start off explaining the function and what it does, the arguments you can pass to it, what you will get back from it, and any special notes. Then they show some real world examples and finish with user contributed notes. In my opinion this is perfect. It’s just the right amount of information to get anyone started, and it serves as an excellent reference. Not too much and not too little. Just right. Goldilocks knew her shit.

OK, back to YUI. I got into YUI sometime around their version 2.2.2 release in 2007. This was their first big release. Back then, YUI had basic documentation, not unlike PHP’s structure showing examples and explaining how-to-use the various features. My first problem arose when I needed help beyond what the YUI team had published. There weren’t many YUI tutorial or fan sites, so I turned to the YUI forum, which used to be a basic Yahoo! Group. This is where I got stuck, and in the end is what probably lead me to stray. The YUI group was pretty quiet, but the worst part was that I never received any real help. I’d post questions and they’d be completely ignored, which left me to turn back to my own resources and spend hours trying to figure out what was wrong. I’d pour over the YUI documentation, looking to see why I couldn’t do what I thought that I should be able to do, only to throw my hand up in frustration and walk away. Later I discovered errors in the YUI documentation but I couldn’t figure out where to make corrections or who to tell so that they could fix the problems so that others wouldn’t fall into the same hole that I did. I finally discovered that YUI was running a bug tracker on Sourceforge so I reported my bugs there and most of them were eventually, albeit silently, fixed. So after all this moving around from the YUI site for examples, the Yahoo! group for discussion, and Sourceforge for bugs, I was tired and discouraged. I felt like I was spinning my tires and getting very little in return.

About this time, jQuery had released a new version (1.2.6 in 2008 I think) so I decided to check them out and see what was going on in that camp. I was pleasantly surprised with what I found. Not only did it seem like the jQuery project was growing bigger and bigger, but jQuery turned out to be easy to learn and use. Documentation was structured along on the same lines as PHP, however discussion about jQuery relied on Google groups. Uh-oh. At first I thought that this was going to be a repeat of my YUI experience so after trying some examples I decided to post a few questions to the group to see what kind of a response, if any, I’d get. To my surprise I received answers right away and they were useful, clear, and friendly. But the real shock was the small learning curve that came with jQuery. I was able to get up and running much faster with jQuery than I was with YUI. jQuery seemed more intuitive than YUI. Plus, jQuery was big on plugins, something that YUI barely mentioned. Plugins allowed you to not only easily use code that someone else had written, but you could build upon it and tweak it to do whatever you wanted. I was hooked.

To me, the simplicity and brevity of jQuery, along with its ability to create powerful and useful code with a small footprint, and plugins is what really makes it like the Swiss Army knife of JavaScript. YUI just wasn’t there yet and if it was, the YUI team wasn’t able to get that message across and share it with everyone. I don’t know about you, but once I find a product I like I tend to stick with it. While YUI, Mootools, and Dojo (et al) are all popular, competent JavaScript libraries/frameworks, nine times out of ten I’ll go out of my way to find a jQuery solution to a problem before I try to start learning another tool.

Around the same time that I was getting heavy into jQuery, Yahoo! released version 3 of YUI. So being a former YUI user I decided to see what the new version was all about, wondering if they had taken a huge leap forward. Maybe Yahoo! had addressed all my concerns with the fragmentation of documentation, errors, and support with this new release. In my opinion, while the technology of YUI 3 may have improved, unfortunately most other issues seemed to have stayed the same if not gotten worse. I tried to go through the examples and documentation of this new version only to find the learning curve even steeper than before. It seemed that anything YUI 3 could do, jQuery could do and with less pain. Many of YUI 3’s features were in beta form as well, including things like widgets and plugins. Maybe I didn’t give YUI 3 a fair shake since I had been turned off to it in the past and was also so satisfied with jQuery. Maybe I’m just not smart enough for the high level explanations that the YUI team likes to provide (although I have my BS in computer science, a MBA in business, and a pretty decent IQ so I’m hoping that’s not it). I’ve never enjoyed complex things that can be made simple. I love simplicity. And to me, jQuery is the epitome of simplicity. On the plus side for YUI 3, they seem to have a whole new discussion forum although I can’t attest to whether its any better than the last one (although I can say it’s far more tan/mocha colored than the old one).

That said, I suppose the rivalry that goes on between all the JavaScript libraries/frameworks is a good thing and that the friendly competition that it generates can only help spur on better development tools for everyone. In the end, each developer should use whichever tool he or she is most comfortable with and for me, right now that’s jQuery.

4 thoughts on “Why I Use jQuery Over YUI

  1. Amen! Simplicity is the key. I really don’t like using other people’s code; part of that is because I’m a bit of a code control freak, but part of it is because I want to be able to fix problems or come up with creative solutions, which I can’t do if I don’t know how the code actually works. Not so with jQuery; not only can I find all the help I need on the website, but the code is so intuitive that I find myself less and less even needing to look for help. On top of that, it covers a multitude of non-standards-compliant browser sins, which makes my job that much easier. I might not know all the bits of jQuery that make it tick, but I do know that it runs, it runs well, and it’s actually fun to use!

    Oh, and, great blog; I appreciate the tips you’ve provided!

  2. I have to use YUI at work, from YUI2 to YUI3, and I never feel clicking with the structure and concept of YUI. What I need to write lines of code to accomplish in YUI, is only one line in JQuery!
    The application we implemented in YUI is extremely slow. JQuery accomplishes more complicated stuff with much less overload. I simply love JQuery much better than YUI.
    The design philosophy behind JQuery is apparently different from YUI. JQuery tries to make it as concise as possible = so that file size is small and loading is fast. YUI tries to develop an object oriented structure, with packages and hierarchies, and that is what it ends up to be. Do we really need all this complicated structures and hierarchies? Sometimes, but not at such a high cost.

  3. Sure jQuery is simple and its handy for really simple tasks, but if I’m working with a team of developers on a large UI intensive web application jQuery just doesn’t cut it. Modules, testing framework, combining static resource requests, packing js source at build time, the list goes on. YUI does it all. It really helps you standardize your code across a whole team and the way YUI is layed out helps you look at your Javascript in a more design pattern oriented way. The best part is that you don’t really HAVE to use anything. You can mix and match only the things you need, everything is very loosely coupled and cohesive. FYI the docs are fantastic, see yuilibrary.com. Also there is a youtube channel with tons of presentations from past YUIconf’s and for realtime help i’ve always gotten answers from the many developers in the YUI mirc channel.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: