jQuery vs Prototype

I have been using the Prototype Javascript library for my client side needs as of late. It works reasonable well and there are a number of shorthand operators that simplify (albeit obfuscate) my code a bit. The thing I find disheartening is that alot of JS programmers discredit Prototype for its lack of documentation and extending of of the native data types (String, Array, Object).

I haven’t run into a single case in my experience where the extending of the native types has caused any problems. The thing that does cause me concern is the fact that Prototype is 71K uncompressed. I have tried packing it, but it just mangles the code. Then I tried Alex Russel’s rhino-based packer, it works but it doesn’t compress near as well as Dean’s. So I am still left with a 48K JS file.

jQuery on the other hand does compress with Dean Edwards packer and it packs nicely (53K down to 19K). But it is a massive paradigm shift in the way the library approaches Javascript. Where Prototype extends native types and creates its own with some shortcuts to save code, jQuery wraps everything in its own custom jQuery object then works on that. I haven’t had enough experience with jQuery to comment intelligently on it but I am hesitant to learn a library where it essentially discards the native types and does its own thing. You hand it either a DOM object, or JS object and it hands you back what it thinks you want based on how you manipulate the jQuery object after its be instantiated. Maybe I am looking at it too simplistically, but that is what I have seen thus far and I haven’t been liking it much.

Oh, and everyone complains that there isn’t any documentation for Prototype? Sergio Pereira keeps the documentation up-to-date and in multiple languages here. That has been more than sufficient for me, granted it doesn’t have the slick interface that VisualjQuery.com has.

Comments are closed.