Tuesday, May 3, 2011

dojo, prototype and jquery

Hi,

I've been programming in PHP for some time now, and id like to start learning how to create more dynamic websites using AJAX.

The question is - where do I start? Heres' what I'm considering:

  • prototype + script.aculo.us
  • dojo (with/without Zend Framework)
  • jquery

What book should I buy? Are these different libraries, or the same? Plus, what IDE should I use? (I'm on OSX). Aptana? Komodo? I'm currently using Zend Studio, is there a more WYSIWYGish editor?

Thanks!

From stackoverflow
  • They are different but essentially do more or less the same thing... abstract away browser inconsistencies, add extra useful features etc...

    I'd go with jQuery, as it seems to be the most widely used and is close to the standard library. Microsoft and Nokia have adopted it, if that's any help.

    Visual Studio has intellisense for jQuery, but I can't comment on it as I'm not a .net developer. Otherwise my IDE is just Coda for Mac, it doesn't have jQuery intellisense, but the docs are only a few clicks away.

    The online docs for jQuery are quite good, but I know there are some books out there. I haven't read any so I can not recommend. This seems like a useful site to get started with.

    If you are only using AJAX (not animation or any of the other features), you may want to try an AJAX only library.

  • Some other SO topics address the same question:

    My take on this is the following:

    Seriously, nobody can tell you which framework is best for you. There's only one way to find out: try playing around with all the different libraries you're considering. It's a matter of personal preference.

    See this excellent JavaScript Library Overview, a presentation by John Resig (who happens to be the lead developer of jQuery). It contains small code samples for all the listed frameworks. After viewing those, you'll probably know which framework to choose, depending on which coding style you prefer.

  • I don't want to start a flame war, but I'd avoid Prototype and MooTools altogether, despite whatever might be good in either. (Disclosure: the first Ajax library I used was Prototype.) Some very smart and thoughtful programmers have gotten themselves into big trouble using libraries that make unsafe assumptions. An obvious unsafe assumption is that some variable won't be defined by other scripts. (The case in point I'm thinking of is a media web site that integrated lots of different 3rd party scripts.) The big crime of many libraries, especially Prototype, is assuming that it's safe to modify native objects like Array (or Object!). When I added Prototype to my project, poof went my for-each loops over arrays, because suddenly they all had a dozen extra functions, each of which is considered a member (objects are just hashes).

    I love object-oriented syntax as much as anyone, but modifying core objects simply isn't safe. $ is evil. :-)

    So for my money, YUI is the only really safe library. jQuery would be my 2nd choice.

0 comments:

Post a Comment