Picture via Dunechaser
I still get asked “what Ajax framework should I use?” frequently indeed. I think that people feel that with my Ajaxian postings I have seen every framework in the world and will have a magic feel for things.
I dread these questions, as context is king for making the decision, and “feel” is a major part of it too. The various frameworks have in many ways come closer together over the years, so making the choice is harder, but also maybe not as big a deal as it once was.
That being said, I really enjoyed Glenn Vanderburg talk about why he prefers Prototype to jQuery. This is the kind of subject that is asking for trouble and foaming at the mouth from people on various camps. Glenn has the kind of nature, wisdom, and touch that makes it hard to think that way. He gives thoughtful points and isn’t trying to cause a stir.
These days, without any real context (e.g. skills on the team, what the project does) I kinda think:
- jQuery is fantastic for taking a website and making it dynamic. Easy. elegant. Beautiful. If I was a designer doing a rich site I would stop here.
Prototype, for me, fits in between these worlds. It is small enough to feel small (not a huge library to learn) yet large enough that I don’t jump out into creating a lot of my own code.
On a recent jQuery project that grew fairly big and I found myself surprised that the core didn’t have certain methods and features. Much of it was small things (one example I remember is array utilities). I would find myself looking around for plugins, wondering which ones are good, and generally having a little bit of a tough time. Then there is a the type system. For something that isn’t strapping on a bit of code to the web site, I actually like Class.extend and the like. With jQuery I would use Traits or Base or something which is fine…. but not just there in the same way.
I get used to
myArray.last() and having the convenience methods available to me directly on the objects, even if the puritan in me feels a little strange. Just as Ruby “felt right” to me. Prototype does too (duh, since its heritage). A blend of purity and pragmatism. More often than not Prototype surprises me “oh, wow, it has that function already!” On another recent project that got converted to Prototype, I was able to delete a LOT of code. Utility classes went away. Libraries went away. There is nothing better than the feeling of deleting code. Am I right? :)
So, I agree with Glenn. For me, Prototype is the right balance for many of my projects. I still enjoy playing and using others when the project calls for them, and I am ignoring the huge number of other great frameworks (YUI, GWT, MooTools, Ext, SproutCore, Cappucino, man I could go on forever here).
January 20th, 2009 at 12:51 pm
January 20th, 2009 at 1:39 pm
I agree with Dion’s path of discovery regarding Prototype. There are a lot of handy tools packed in there and there are always more tidbits to find. It has saved me countless hours of work.
Sadly, I think Prototype is losing the popularity battle. For example, over at StackOverflow.com, there are over 1000 jQuery posts, and under 100 for Prototype. While I, and others, continue with our efforts to nurture the Prototype user community, having someone like MS jump on the jQuery bandwagon sways a lot of developers in that direction.
Prototype’s early success really helped move the technology forward. What is needed now is someone big to bolster Prototype’s position in the marketplace.
January 20th, 2009 at 1:59 pm
Sometimes a big community isn’t that good.
In a big community you’ll have the advantage of beeing able to find more plugins and extensions and stuff like that, that’s for sure, but I doubt that the quality of those extensions will always be that good.
I like small communities of “clever” people.
For example, the Mootools community isn’t very big, but the Core and More builds of their framework are very carefully coded, with elegant and readable code.
They have an excelent balance between imperative, OO and functional programming paradigms.
They have a well thought Class object, that allows extension and implementation (something like multiple-inheritance).
A good OO design (Fx.Base, Fx.CSS, etc).
Very handy utility functions ($extend, $H, $merge, $empty, $lambda, etc).
And a modular code (you can make your own build).
Anyway, that’s the library I feel most comfortable with.
January 20th, 2009 at 5:06 pm
I was thinking recently about Prototype and jQuery. My impression is this: Prototype is heavily object-centric, so when you’re dealing with objects themselves, it has wonderful methods available. jQuery is DOM-centric, so dealing with the DOM is a breeze in jQuery. Now, let’s get Prototype’s methods into jQuery and we’ll have a perfect world. ;-)
January 21st, 2009 at 1:27 am
Well summed up, I totally agree. But with the support and momentum behind jQuery how can you recommend Prototype for a new project?
January 21st, 2009 at 3:31 pm
@Nicolas: In some cases you’re right. Luckily, we’ve had a ton of success in attracting extremely sharp people to the jQuery community. In addition to that, we have one of the most supportive and accepting communities around. We’re more than willing to work with people that may just be starting out in their client-side experience and help them through many of the hurdles found in JS development. The same can’t be said for all frameworks, which adds to the attraction of the jQuery project.
@sean: The fact that there are lib choices is a good thing as it allows developers to use the best tools for their specific needs. One of the things that we’ve really pushed within the jQuery project is ensuring that we play nice with other libs and we’ve worked closely with the Prototype team to make sure of this. We realize that jQuery doesn’t fit the bill for all developers and it’s important for us to not impede a developer’s need to use another lib.
Rey – jQuery Project
January 22nd, 2009 at 3:27 pm
I am shocked and surprised that anyone would care what Microsoft is supporting. In fact, from my perspective, that means that JQuery has to be difficult to use because the underlying Microsoftian philosophy is that you are an idiot and we have to hold your hands every step of the way lest you fall and bump your nose. When I hear Microsoft, I turn and go the other way.
January 23rd, 2009 at 2:05 am
Try being open-minded, Patrick. Lots of people are using jQuery, not just Microsoft.
January 23rd, 2009 at 10:43 pm
@Patrick it’s a little weird for me to defend jQuery but not only is Microsoft’s association with jQuery recent but they are not the controlling interest in the project.
Also, thanks for the cauldron of awesome that is Ajaxian.