views:

1579

answers:

4

Hi,

Will choosing between jquery or YUI change the overall/high level design of your .js files or would it realistically only going to be the inner workings of your js functions due to the differences in framework API's? (i.e. how you access/traverse the DOM, selectors, built-in functions, firing events, etc.)

+5  A: 

When you compare the stucture of both libraries:

YUI:

YAHOO.util.Dom.setStyle(['test', 'test2'], 'opacity', 0.5); 
var opacity = YAHOO.util.Dom.getStyle('test2', 'opacity');

and jQuery:

$("#test, #test2").css("opacity", 0.5);
var opacity = $("#test2").css("opacity");

They look pretty similar.

So the general flow of the script should be about the same with both libraries.

The differences I see are in simplicity and length. I personally feel like jQuery makes more sense but if you don't mind the nuances of each I'm sure they can both fill your needs.

Birk
I just like the fact that YUI has a fully supported library, while jQ relies on 3rd party developers (might not be a bad thing, just more comfortable that way), but what gets me is that since MS is shipping with jQ might as well go with jQ...bah!
Blankman
I know what you mean. On the plus side though its easy to keep just the parts you like even if they change later.
Birk
I think the way I play with jQuery is easier and funnier than YUI. It looks more complicated then jQuery.
Braveyard
+2  A: 

There isn't much difference in terms of architectural decisions between YUI and jQuery. A library like Google Web Toolkit (GWT) or Dojo might have significant impact on the way you architect because of their need to be compiled.

On a side note I'd say that I prefer YUI to jQuery for exactly the same reasons as the other answer to this question. I find the style of jQuery to be obtuse, it's kind of like Perl. If you don't already know the syntax it's not clear what the meaning is. While YUI is a bit more verbose I find the code very easy to parse.

My disclaimer is that I work at Yahoo! though so I'm used to using YUI a lot, and mostly only tinker with jQuery for personal projects ;)

sh1mmer
+1  A: 

I would say that yui, and especially yui3 encourage and makes it easy to keep your code modular. You have the yui loader where you can pull in parts of your application on the fly, and you also have rich support for synthetic events that lets you decouple parts of your application a bit more.

You aren't forced to use these features, but if you do it can help you build more modular applications and aid code re-use.

unomi
A: 

jQuery is easier to learn as compared to YUI, Though there is no much more difference in architecture.

Ajuba