After now almost 2 years in a job with extensive web development, I have also come quite into using AJAX as a mean of increasing usability. But is it really feasible, and what is it really good for in the end? Earlier I have been using prototype, which was good, but has some not so good flaws…
The bad sides about prototype becomes aparent in two situations. Firstly in long time use, where the user has a single page open which does repetitive “live” updates. But prototype is designed to load HTML pages, and put it in “containers” in the live web page. This gives a bad problem especially in Firefox, which caches all these pages until the entire page is reloaded or closed.
The other problem is also visible in other browsers, but is not as severe. Prototype “extends” every DOM object in the page that it works on with a large set of new data and methods. And in cases of large pages, this can become an extensively large payload. And this “attribute”in combination with the previous can put the fox to a complete halt, even on a powerful workstation.
And the solution? jQuery!
But in more detail.
- Prototype uses a set of defined OO function extending the DOM tree itself as the base of the library. jQ only creates the jQuery function (and object and methods, and the '$' shorthand, which sadly collides with the '$' method in prototype).
- Prototype works on a single DOM object at a time, while jQ can collect DOM objects, and work on them with callback functions.
- Prototype is bound to work from the ID's of the DOM objects, and otherwise do manual programming in JS. jQ can access the entire DOM tree through both XPATH and CSS like syntax.
- Prototype uses a set of extended JS collection classes to administer data, while jQ uses simple JSON structures and Arrays, and has internal methods for iterating them.
- Prototype has no "stable" DOM builder (as of last I checked, a few weeks ago), jQ has a simple extension: jQuery-DOM that does the job, almost too easily.
Other web programming tools that have come before me since last post here, is the Code Igniter MVC framework for PHP. As opposed to Zend, which I have looked at earlier, Code Igniter (CI) is not dependent on PHP5, but also works fine on PHP4. It is also cleaner, in the sense, that it has less “optional/extension” code that most users wont need.
And a good property of CI, is the BSD license, which makes it easy to take parts of the system, and integrate it into your business’ code. Both CI and MVC is good, but I wont take any of those into details now. But take a look if you struggle with your PHP code, and want a system to clean up out code.