Web Hosting Talk







View Full Version : jquery, prototype, ... vs javascript


thosecars82
05-22-2008, 02:17 PM
Hello there
I wanted to ask you whether it is worth or not using tools such as jquery or prototype comparing them to javascript.

What do you suggest? Using those libraries or rely just on javascript?

I knew javascript but I have got to know recently these libraries which seem to reduce the amount of code. Therefore, I do not know much about this issue. Nonetheless, if I have to give it a try, I might think that using just java script gives me more control than using those libraries. On the other hand, those libraries such as jquery or prototype might speed up the development.
Please, I would appreciate your suggestions about purposes and pros and cons of using either libraries or only javascript.

Thanks in advance

Jamie Edwards
05-22-2008, 02:23 PM
jQuery and Prototype are all JavaScript, and simply provide an extensive JavaScript library for easy use of JavaScript and developing dynamic interactive websites?

Saeven
05-22-2008, 02:37 PM
Jamie is correct, they are Javascript themselves.

Prototype is a bit special though, as it overrides some basic constructs to bring things like the $ operator. Prototype _can_ cause co-existence problems. If you use it homogeneously though, it's a great tool.

Nonetheless, if I have to give it a try, I might think that using just java script gives me more control than using those libraries. On the other hand, those libraries such as jquery or prototype might speed up the development.Not only that, they often tackle hurdles for you without your knowledge. Cross-browser compatability is something that's very difficult to assert when starting from scratch. There are hours and hours of sweat into these libs.

(disclaimer: ExtJS is the best!)

You cannot mention Prototype and jQuery without mentioning the king of them all though -- ExtJS! Take a trip to http://extjs.com , it'll help your project soar into the stratosphere with just a little kick!

With any of these libs, you should have a strong grasp on closures, and functional programming. Here's a good link on the topic: http://www.jibbering.com/faq/faq_notes/closures.html

Good luck!
Alex

Burhan
05-23-2008, 05:46 AM
+1 for extjs -- definately worth looking at twice.

Adam-AEC
05-25-2008, 09:05 PM
ExtJS is great but does require licensing for commerical projects.

jQuery is definitely the winner (imho) over Prototype.

Javascript framework over roll-your-own Javascript? I suppose it depends on your complexity of your code. I wouldn't include jQuery (54kb) if all you are doing is a few lines of Javascript.

jQuery (or Prototype) *should* increase your javascript development. Plus, $('#page') just feels more natural than document.getElementById('page')

thosecars82
05-26-2008, 05:44 AM
ExtJS is great but does require licensing for commerical projects.

jQuery is definitely the winner (imho) over Prototype.

Javascript framework over roll-your-own Javascript? I suppose it depends on your complexity of your code. I wouldn't include jQuery (54kb) if all you are doing is a few lines of Javascript.

jQuery (or Prototype) *should* increase your javascript development. Plus, $('#page') just feels more natural than document.getElementById('page')

Thks, I did not know it required licensing for comercial projects. Good to know because in that case I might use jQuery or Prototype.

Saeven
05-26-2008, 10:27 AM
It's worth the cost really. Their support alone is worth it, especially so for any commercial endeavor.

The Ext selector is:
Ext.get( 'abc' );

thosecars82
05-26-2008, 10:31 AM
It's worth the cost really. Their support alone is worth it, especially so for any commercial endeavor.

The Ext selector is:
Ext.get( 'abc' );

I do not want to make any offence, but aren't you a salesman of this product? Well, it just might seem so.
Anyways, I do not understand what this "The Ext selector is:
Ext.get( 'abc' );" mean.

Saeven
05-26-2008, 10:46 AM
No I'm not a salesman lol. I'm just at the head of a company that got burnt chasing the tail of promises made by most other javascript libraries.

Anyways, I do not understand what this "The Ext selector is:
Ext.get( 'abc' );" mean.

I was offering a comparison to what Adam had posted:

Plus, $('#page') just feels more natural than document.getElementById('page')

A selector is a means to select a component by some property in the DOM document that composes the page being adjusted. Consider:

http://extjs.com/blog/2007/07/10/css-selectors-speed-myths/

You can find neutral such benchmarks online as well, the results are all the same. Ext still has the championship belt in speed.

thosecars82
05-26-2008, 11:04 AM
No I'm not a salesman lol. I'm just at the head of a company that got burnt chasing the tail of promises made by most other javascript libraries.



I was offering a comparison to what Adam had posted:



A selector is a means to select a component by some property in the DOM document that composes the page being adjusted. Consider:

http://extjs.com/blog/2007/07/10/css-selectors-speed-myths/

You can find neutral such benchmarks online as well, the results are all the same. Ext still has the championship belt in speed.

Healthy competition. Thks for that useful information.

Czaries
05-26-2008, 02:02 PM
I have to throw in my $0.02 here and vote for jQuery (http://jquery.com). The development progress on it has been quite impressive, and the number of available plugins and community support for it continues to soar to levels unreached by similar Javascript libraries (which is why the company I work for picked it over other available libraries). A nice bonus is completely free and unrestricted use for any project.

It's worth noting that jQuery also has a "no conflict" mode where you can use jQuery('#abc0) instead of $('#abc').

sasha
05-26-2008, 03:37 PM
http://extjs.com/blog/2007/07/10/css-selectors-speed-myths/

You can find neutral such benchmarks online as well, the results are all the same. Ext still has the championship belt in speed.

Note that tests use old version of jQuery. New version brings even more speed improvements.

Btw, another vote for jQuery :)

prickett233
05-27-2008, 12:17 AM
A vote for JQuery here. Have used Ext before but find it slow to use on lower powered machines when it comes to GUI interaction.

DarkStar-Brett
05-27-2008, 01:14 PM
jQuery also gets my vote -- especially for the compatibility reasons.

Saeven
05-27-2008, 01:16 PM
Nobody's voting for Dojo these days eh? ;)

DarkStar-Brett
05-27-2008, 01:32 PM
I've used Dojo and I cannot say that I like it nearly as much as jQuery. There's a lot more support for jQuery and one of the reasons that I think most people prefer it.

stdunbar
05-27-2008, 01:40 PM
Plus, $('#page') just feels more natural than document.getElementById('page')

Wow - I guess it depends on the programming environment you're used to because I wouldn't have the slightest idea what the first syntax meant. If you are used to referencing variables via regular expressions then I guess the first makes more sense. If you are used to a regular programming language then the second makes more sense.

I personally like mootools (http://mootools.net/).

Czaries
05-28-2008, 03:24 PM
Plus, $('#page') just feels more natural than document.getElementById('page')

Wow - I guess it depends on the programming environment you're used to because I wouldn't have the slightest idea what the first syntax meant. If you are used to referencing variables via regular expressions then I guess the first makes more sense. If you are used to a regular programming language then the second makes more sense...

Actually, jQuery selectors (http://docs.jquery.com/Selectors) use CSS selectors (http://www.w3.org/TR/REC-CSS2/selector.html) for everything, so it's not some cryptic regular expression that's being used - It's a standard and well-known CSS selector that's been around for years.

This is a great article to read:
http://jquery.com/blog/2006/08/20/why-jquerys-philosophy-is-better/
Granted it's from the jQuery site so it's little biased, but it's still a good overview on the driving force behind jQuery.