Page 1 of 2

Why prototype?

Posted: Mon Jun 11, 2007 11:54 pm
by JellyFish
Why do people even use Prototype's API if there's jQuery? Is it ignorance? Do people even know about jQuery, and it's simplicity and power?

So why Prototype, or any other API for that matter?

What's missing in jQuery that it's not the most popular?

PS: I was really trying to get at this in my last client side post, which I deleted.

Posted: Tue Jun 12, 2007 12:00 am
by feyd
Variety is good.

Sometimes the choice of library is out of the individual developer's hands.

Posted: Tue Jun 12, 2007 12:09 am
by Luke
Also, some people are used to working with the DOM. Prototype provides the user a way to work with the DOM the way they are used to working with it, only with shortcuts and easier access to the things they use most often. jQuery is a total abstraction of the DOM. You don't need to know about all the inner-workings of it. For me, this is good, because at this point, I'm just not interested in messing with all of that.

Posted: Tue Jun 12, 2007 12:23 am
by JellyFish
I'm having a little bit of a hard time working out which one I want to use.

jQuery is the only one I've used. The only problem I'm having is with the Interface extension. The Demo's easing effects don't work on any of my browsers: Firefox, IE, Opera or Safari.

Will they work when I download it?

Posted: Tue Jun 12, 2007 12:49 am
by feyd
Can you define doesn't work?

Why haven't you downloaded it and tested them on your own?

Posted: Tue Jun 12, 2007 12:53 am
by JellyFish
I got it now. I forgot to include the easing.js file, thought that easing effects were built into the interface.js file.

Posted: Thu Jun 14, 2007 12:22 pm
by the_drizzle
jQuery is a godsend! Technically it's preference, but even more technically, you should just use jQuery. Can you tell my favourite? ;)
Also check out Interface. If you like GUI, then you should like Interface, which runs on top of jQuery. The obvious contender is Scriptaculous but I find Interface is a larger library and it's easier to use.

But yeah. It's completely up to you.

-----------
Edit
-----------

Sorry, you already knew about interface.... Oops.

Posted: Thu Jun 14, 2007 12:46 pm
by CoderGoblin
You could also look at the extjs which can also use jquery.

Posted: Thu Jun 14, 2007 5:46 pm
by Ambush Commander
Here's what I've found: jQuery is a bit lacking when it comes to OOP-emulation features that Prototype is quite famous for (it's not called prototype for nothing). While one may argue that OOP is not the paradigm one should follow when coding in such a flexible language like JavaScript, it has certainly been frustrating trying to implement polymorphism and base classes in jQuery.

Posted: Thu Jun 14, 2007 6:52 pm
by Christopher
I hadn't seen Interface before -- pretty cool for javascript.

http://interface.eyecon.ro/demos/carousel.html

Posted: Thu Jun 14, 2007 7:06 pm
by alex.barylski
Oh nice...that was JavaScript doing that? I always thought it was Flash...heh...cool...

I'm def. gonna use jQuery now for sure 8)

Posted: Wed Jun 20, 2007 11:17 am
by the_drizzle
Ambush Commander wrote:Here's what I've found: jQuery is a bit lacking when it comes to OOP-emulation features that Prototype is quite famous for (it's not called prototype for nothing). While one may argue that OOP is not the paradigm one should follow when coding in such a flexible language like JavaScript, it has certainly been frustrating trying to implement polymorphism and base classes in jQuery.
Oh yeah. I really agree that there are differences between jQuery and Prototype. They are not to be confused with two different 'products' designed with the same purpose.


It's funny, JavaScript is probably one of the most OO languages around. It's more object oriented than Java. It's just that no one ever really talks about JavaScript's OO side because the context is usually web UI. And I'd definitely say that an OO approach with JavaScript is a great way to go.

As for polymorphism and the like, I think jQuery should - or is supposed to - be used as a library or as a DOM manipulation framework. Prototype is a little bit different in that it strives to be an entire client-side framework. jQuery is to pieces of the PECL as prototype is to the Zend Framework or CakePHP. Personally, assuming I'm going OO in JavaScript, I'd build OO framework that uses jQuery, avoiding integration madness.

But then again, my thoughts may have been invaded by bias.

Posted: Wed Jun 20, 2007 1:30 pm
by Ambush Commander
Well, they do call themselves a "library" and specifically makes accomodations for other libraries. That being said, I don't want to use both Prototype and jQuery and have DOM/Events/AJAX code all duplicated.

Javascript doesn't natively support OO constructs, so I wouldn't call it an OOP language per-say, but its objects are so flexible that you can implement all of them with ease.

Posted: Wed Jun 20, 2007 2:24 pm
by the_drizzle
Ambush Commander wrote:Well, they do call themselves a "library" and specifically makes accomodations for other libraries. That being said, I don't want to use both Prototype and jQuery and have DOM/Events/AJAX code all duplicated.
Oh, you'd certainly not want to use them together. I was suggesting using jQuery and then writing something else - like Prototype - to use it. You could even harvest from Prototype if you're risqu'e.
Ambush Commander wrote: Javascript doesn't natively support OO constructs, so I wouldn't call it an OOP language per-say, but its objects are so flexible that you can implement all of them with ease.
Really sorry about this. Looks like I'm about to rant :| (it's not directed at anyone in particular :)).

JavaScript doesn't natively support Java's OO constructs. Mainstream OOP languages such as Java and C++ are not the definition of OOP but rather a demonstration. A couple of things to consider: it's really easy to make lots of money in software development, we are in the middle of a globalization revolution, and theoretical computer science is still an incredibly young subject. These issues create a pattern of bandwagon hopping and the world ends up with tons of Architecture Astronauts and too much hype about nothing. JavaScript supports all the OO Java does and more, just with a different syntax. You might even call the OO capacity of JavaScript a superset of the OO capacity of Java. The real difference is that most OO structure in Java is defined statically, but with JavaScript, it's defined statically and dynamically. Nearly everything in Java is an object. In JavaScript, nearly everything is an object, including functions. JavaScript doesn't even technically have functions. It simulates functions by cleverly using objects and constructors. How much more OO can you get?

Posted: Wed Jun 20, 2007 6:12 pm
by JellyFish
I'm using jQuery a lot, it is my first lib I've used. I just don't want to waste any time on a library that's not going to benefit me to the fullest extent.

Which do you recommend and why? Prototype, jQuery or Mootools?