Categories
jquery php

jQuery vs Prototype, a newbies perspective

When I first started to dabble with javascript and ajax, Prototype was the only game in town that was making any headlines. So of course I used prototype with script.aculo.us .  I was able to make some simple stuff, but my coding with Prototype wasn’t very elegant and it certainly wasn’t the best way to code things.  But you know what, I’m a javascript newbie and  it worked!

Over the last few years it seems like Prototype development has slowed down a lot, while jQuery is making huge headway.  Every tutorial I see is using jQuery.  So I FINALLY decided to buy a book and learn it.  They are vastly different to say the least.  My prototype code had an awful lot of onclick=”” kinda stuff inside the HTML, while jQuery let’s your code appear more transparent and natural.  I love being able to pass my own variables using html attributes.

I went through a lot of WTF, why isn’t this working moments during my first attempts at coding using jQuery techniques.  However, overall I love jQuery.  Now my code is optimized, cleaner, and I feel as though I am not limited in what I want to do.  If I can dream it, I can code it with jQuery.  Not a small feat for someone like myself.

For example, with Prototype I simply didn’t know how to show a loading gif when an ajax command was in use.  It sounds simple and a lot of you are probably thinking what an idiot.  I turn to jQuery and my first attempt I find that it’s so simple to achieve.  Not only that but I can easily manipulate form values, check their validity,and pass them along with no problem at all.

To learn jQuery I completely rewrote all of my javascript code for FantasySP.  It took me about 2 LONG weeks, but now I feel as though I can code just about anything I want.  My code is a mere 7kb in size now, compared to 49kb in Prototype.  I am actually making reusable functions now and you can too.

My only quibble with jQuery is that coding an advanced autocomplete function is a huge pain in the ass.  Prototype let me customize it from the backend (PHP), whereas jQuery forced me to use JSON and adding extra javascript code.

So for those of you who haven’t used a framework before, or are still using Prototype, give jQuery a try.  You won’t be disappointed.

8 replies on “jQuery vs Prototype, a newbies perspective”

I my self am a prototype user at the moment thinking of making the jump to jquery so i stumbled upon your article while looking for some info to motivate me to make the change. I have to say that you obviously spent a lot more time learning Jquery (you say you read a book) since what you are saying about prototype just does not apply. If you where using 'onclick=”” kinda stuff ' like you say obviously you had no idea how to use prototype and adding a loader gif is extremely easy with prototype and in general the ajax funtions are pretty slick. On the other hand I to find that prototype development has slowed down and it seems most people are heading to the jquery camp which is very important because it means a lot more plugins and stuff are being created for jquery which can really speed up development. This is one of the reasons im considering moving to jquery but i do believe both frameworks are equally good for helping you with writting javascript code.

Thanks for your input Charlie. Yes, there is no doubt that I am a Prototype newbie and did not have a firm grasp on the framework. That made the switch make even more sense for me.

If you do give jQuery a try let me know how it goes. 🙂

Prototype isn't decreasing, it is increasing development, same with jquery. however script.aculo.us is decreasing development.

http://www.ohloh.net/p/scriptaculous
http://www.ohloh.net/p/jQuery
http://www.ohloh.net/p/prototype

ohloh.net always seems to help :). I like both jquery and prototype the issue I had with jquery is its lack of using the native elements. If you ever use the canvas tag to draw you have to use a built in method to get the context. I couldn't do $('my_canvas_element').getContext('2d') in jquery, but I can in prototype. Which is why I use prototype for all my not user interface stuff.

“Prototype isn't decreasing, it is increasing development,”

Where? How? When? As far as I can tell, there is currently no development of Prototype going on. The project seems to have stagnated completely. I'd even say it's dead. Where is the increased development to be seen? How is it measured?

What a joke… I started with jQuery and moved up to Prototype!
Because we needed more than a few gadgets here an there, we needed to build a full enterprise class web application jQuery quickly fell flat on its stomach but Prototype has a lot more muscle, it can be a bit more work at first but you can do so much more with it. The project is still very active despite the constant “thuzz” created by MicroS$#@$, check out for yourself at: http://www.prototypejs.org/2010/10/12/prototype-1-7-rc3-support-for-ie9

Prototype is far more scalable and intrinsic to JavaScript than jQuery. jQuery has more support and a larger user base, but having used both, I must say that Prototype just writes much more smoothly.

Prototype is far more scalable and intrinsic to JavaScript than jQuery. jQuery has more support and a larger user base, but having used both, I must say that Prototype just writes much more smoothly.

Leave a Reply