"Ajax" library recommendations, thoughts, experien

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

jxn
Forum Newbie
Posts: 22
Joined: Wed Jul 13, 2005 4:33 pm

"Ajax" library recommendations, thoughts, experien

Post by jxn »

howdy -

I didn't realize quite popular "ajax" has become recently until I started looking for a simple library to make my web-app (for managing music, but somewhat similar to a "gmail"-like interface) quicker and more user-friendly. Google turns up more results than I even want to think about, and even sourceforge.net has tons of libraries. I'm using php (migrating to v. 5.x), mysql-4.1, and xhtml transitional... I've looked at everything from aajax to xajax, but I just don't know how to evaluate one over another. I've never done any of this "ajax" business before but I have a fair background in javascript... I just want something to make adding "ajax" easier -- a stable library in active development, preferably GPL'ed, because my project is GPL.

Does anyone have any help, comments, experiences, or otherwise with specific ajax libraries?

Thanks much!
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

I highly recommend Rasmus' 30-second Ajax tutorial.

It keeps it extremely simple, allowing you to get started easily, and build from there. Anything beyond that is, like he says, likely to get in the way. :)
jxn
Forum Newbie
Posts: 22
Joined: Wed Jul 13, 2005 4:33 pm

Post by jxn »

thanks, I've already been through rasmus's tutorial as well as a few linked in the comments of his article (he's one of the first hits on a google search), and it was informative enough to get me started working with ajax, but now I'm looking for some libraries to help save time writing and debugging code that duplicates the work so many others seem to have already done.

Perhaps I'll just start with a little trial-and-error library by library until I find one that fits my project, but it seems to me that doing this blindly will be the least efficient manner in which to do this - and probably yeild the least favorable code/application results in the end.

Perhaps, though, it's not worth using an existing library? Any more comments/thoughts?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I prefer to write all of my own stuff, but I've heard of people tooting xajax's horn.

you might want to give that a play...
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

jxn wrote:thanks, I've already been through rasmus's tutorial as well as a few linked in the comments of his article (he's one of the first hits on a google search), and it was informative enough to get me started working with ajax, but now I'm looking for some libraries to help save time writing and debugging code that duplicates the work so many others seem to have already done.
If you want the full blown library style, I recommend Sajax!

Its under the BSDL, so it is GPL-compatible, and its fairly lightweight.
jxn wrote:Perhaps I'll just start with a little trial-and-error library by library until I find one that fits my project, but it seems to me that doing this blindly will be the least efficient manner in which to do this - and probably yeild the least favorable code/application results in the end.
My suggestion is still to simply build from Rasmus' tutorial. It all comes down to what you want to accomplish, and less is more when it comes to html and javascript - even in the lively days of broadband and cablemodems, some people still dial-in. :)
jxn wrote:Perhaps, though, it's not worth using an existing library? Any more comments/thoughts?
I always ask one question when looking at a new library for my projects: Will I honestly use at least 75% of the features it offers? If not, I'm probably using the wrong library, or I'm not taking advantage of the features in a good library.

So, if you look at Rasmus' tutorial, and think "I know I also need X, Y, and Z, and this does none of those", then take that list and look at SAJAX, or XAJAX, and then do the same thing. When you find one that you use ~ 75% or more of the features for, and solve all your concerns, its probably a winner.
jxn
Forum Newbie
Posts: 22
Joined: Wed Jul 13, 2005 4:33 pm

Post by jxn »

thank you so much!!!

In my long list of ajax libraries, I had more or less glossed-over sajax, writing it off as not too stand-out because of the examples on the site, but upon examining the "projects using sajax" link, I discovered the GPL project mp3act, a drag-and-drop reordering script, and a couple of other open source examples that do exact things that my app is going to need to do. sajax looks really quite promising for my app (which is only useful over faster computers with broadband connections and local-area-networks, anyway, so adding a complex ajax lib won't be a problem at all). I'm quite exited to have found this toolkit and to have actual, well-designed examples to work from for inspiration! Thanks again!!
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Roja wrote:
jxn wrote:thanks, I've already been through rasmus's tutorial as well as a few linked in the comments of his article (he's one of the first hits on a google search), and it was informative enough to get me started working with ajax, but now I'm looking for some libraries to help save time writing and debugging code that duplicates the work so many others seem to have already done.
If you want the full blown library style, I recommend Sajax!
SAjax, Xajax, and the rest are quite honestly useless. I'd recommend just learning ajax and building your own. it only takes about and hour to do so anyways. That is, if you are gonna be using this for a business. If it's a personal site, yeah sure, sajax or xajax or any of the others would do.

But I would, by no stretch of the imagination, recommend SAjax as a one-stop solution for ajax. If you are dealing with high-load sites, SAjax will provide so much overhead that you'll be kicking yourself for going that direction.

<3


PS : I would really... REALLY recommend against using XAjax. While SAjax shows only a little of an overhead problem (which grows as the data stream gets larger), XAjax is just horrible. Only someone who knows nothing about how ajax works would recommend that class. The only good XAjax is, is for learning the wrong way to code Ajax applications...

Just an FYI.


PSS:

After re-reading my post, I can see I kind of didn't give you any direction. A great book on learning Ajax and programming practices is "Ajax in Action" by Dave Crane, Eric Pascarello with Darren James.

Not only does this book cover how to avoid overhead, security issues, and bad coding practices, it also goes into basic to advanced codiing practcies using the MVC as a layout. The MVC (Model View Controller) method id perhaps the best method I've seen introduced with Ajax. While MVC is not old or unknown, the principals will seriously strenghten your app. the book also covers almost every aspect of coding an ajax-application.

Other than the book, resources are all over the place. OnLamp recently wrote some nice tutorials for it. They also have a tutorial using ORM and Smarty (Which are GREAT additions to any ajax app you write).

There is some arguments over wether or not the PEAR DB_Object really helps out in deep-level databases, but I've not seen a problem with it thus far (almost a year with it so far using a 5 server mysql replication ring).

anyways, here are some good links for ya. enjoy

http://www.onlamp.com/pub/a/onlamp/2005 ... quest.html
http://www.onlamp.com/pub/a/php/2004/12 ... _tier.html
http://www.ajaxmatters.com/r/welcome
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

infolock wrote:SAjax, Xajax, and the rest are quite honestly useless. I'd recommend just learning ajax and building your own.
Wow, world of negativity, and you are basically just repeating what I said in my first post. And my second.

After the OP posted appreciation for the comment about sajax, because in fact it *was* useful - it was specifically what he was looking for.
infolock wrote:But I would, by no stretch of the imagination, recommend SAjax as a one-stop solution for ajax. If you are dealing with high-load sites, SAjax will provide so much overhead that you'll be kicking yourself for going that direction.
Overhead in what sense? Memory? Filesize? Its *tiny*, and fairly full featured. Granted, they could handle the http stream a little more neatly, and its not the cleanest organization for a php file, but overhead?

(And no one recommended sajax as a one-stop solution)

I'm curious what you mean by overhead. Please be more specific.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

no, actually you recommended he use sajax and xajax. and the 30 second tutorial is, well, quite silly.. it doesn't teach you anything.


anyways, ya might wanna re-read there.


and as for negativity, huh? are you really that vain?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

infolock wrote:no, actually you recommended he use sajax and xajax.
The key was your phrase "One-stop solution". I never recommended them in that sense. I recommended that he look at them, and consider his feature needs against them. Thats a large difference from what you claimed I said, and reasonable in virtually any situation.
infolock wrote:and the 30 second tutorial is, well, quite silly.. it doesn't teach you anything.
On the contrary, it teaches you exactly what you need to know: How to make an ajax request. It was *all* I needed to create multiple ajax apps now - including a rather full featured file manager.

Also, you haven't answered what you meant by "overhead"..
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

if you think it teaches you exactly what you need, ur a fool. sorry, but it's true. all that tutorial does it show you how to make ajax calls. not the background of how it works, methods to improve, or even alternative methods to the xmlhttprequest object.

anyways, sajax's overhead is in that it is being called from within php. a true ajax script is client side, and only issues to the server when NEEDED. ur loading a script, calling the server, and then every time the user wants to issue a command, it skips straight to the server and does all this crap. So instead of the server only handling 40% of your actions, it's instead handling 100%.

as far as the argument with you that you are so strongly searching for, i'm not gonna fall for it. but i will say this : you got your modship didn't ya? =) gee, i wonder why and how that happend since ya always said you didn't wanna be a mod ;) but i'll not continue. the topic at hand is ajax.

the liniks i gave are more than enough, along with the book. if you read these things, u'll be fine. just don't limit yourself to a 30 second tutorial and expect to be an ajaxing king..
Last edited by infolock on Sun Nov 27, 2005 10:14 pm, edited 1 time in total.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

this topic is about ajax and nothing more.

If there are any more posts outside of that scope, it'll be locked.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

if you think it teaches you exactly what you need, ur a fool. sorry, but it's true. all that tutorial does it show you how to make ajax calls. not the background of how it works, methods to improve, or even alternative methods to the xmlhttprequest object.
Call me a fool then. I had never looked into AJAX before until this thread. That quick little tutorial, article, whatever it is I don't care, gave me exactly what I needed (I being AJAX newbie). This was not about improving methods or the background of how it works, it was a 30 Second Ajax Tutorial.

As for your attitude towards Roja, I'm going to propose actions be taken. This is the second time you've lost it. Shape up or ship out.


Edit | Sorry Burrito we posted at same time ;)
jxn
Forum Newbie
Posts: 22
Joined: Wed Jul 13, 2005 4:33 pm

Post by jxn »

alright, back to the topic, then... thanks for the ONLamp articles; I'd already read the first one, but the "Three-Tier Development with PHP 5" article looks interesting, and it might be useful in guiding me through my transition to php5. I got started toying with AJAX through the 30-second tutorial (and, as I said, another couple of brief tutorials linked through the comments)... I think those articles were very helpful because they illustrate how simple ajax can be so that experienced javascript coders can read them and quickly get back into programming some nice ajax components into their sites.

It seems to me that the sajax library will probably prevent me from duplicating work others have already done... if I discover that it's not perfect, I'll either 1) modify it to fit my needs (which might still save time), 2) contribute code to help improve the library, or 3) abandon it altogether. As I already mentioned, a couple of projects are already using it in their apps, so that library looks really promising to me. The mp3act application which particularly interests me seems to work quite well with the library.

As for additional overhead, I'm really not too worried about it. My application is meant for local networks and not the world-wide-web... It'll probably never be used by more than 5 users simultaneously (by anyone who uses it, not just me). It's not for a business.

Eventually, I'll be looking for a book on "ajax programming" so I appreciate the recommendation. I don't have too much time to program and or read while I'm in college this winter/spring, so I'll be hacking little ajax replacements for static forms and synchronous processing. I expect that this little experiment will help teach me which actions in my app are most appropriate for ajax and which aren't before I rewrite the application entirely this summer (I started this project two years ago before I knew what php was, and it's difficult to maintain and very unoptomized... it needs a rewrite, and I feel this'll be the perfect time to fully migrate to php5, mysql5, and "ajax").

If there's one thing I've learned from my past experiences with coding, it's this:
  • * tutorials help (because they show you how to do things quickly and simply)
    * books help more (because they show you how to write maintainable code, not just little snippets)
    * existing applications help more (because they show the way the different code snippets need to inteact, and -- hopefully -- how to organize and comment code to make it maintainable)
    * trying yourself helps the most (because you can learn from your own mistakes)
I'm still willing to take any more suggestions, tips, or even actual experiences with ajax and ajax libraries if anybody's willing to give 'em out. Thanks again.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

for the type of application you are saying that you will be developing, sajax will work great. Just please, don't fall into the xajax library ;) XAjax, while easier to use than Sajax, has so many problems it's just not worth it.

As i can see you aren't gonna use xajax, I'll still post this for any who are thinking about it.

XAjax's main purpose is to make php and ajax-like-scripts easier to build. But it costs you in the long run in that a) it has NO error reporting, b) it (nor sajax for that matter) does not take advantage of php's xml function parsing library, and c) it's poorly written (imo).

SAjax provides a little more hope in the php side of things though. I've bashed it, but I'll admit it has its strengths. For the type of application you are gonna be writing, it would be ideal. Any type of low-traffic app would be great to build against a widget such as that. However, it also will keep you from exploring and understanding ajax as it is meant to be coded. The Main thing is coding style of a MVC. While I will condone using Sajax for the app you are using, I'd also suggest you do exactly what you are saying : read the articles, get the books, and learn ajax, not just a library for it. If you can understand ajax, and then build onto the MVC coding standards for both web-apps and server apps, you will see a dramastic "uppage" in speed and performance, and also easier coding maintenance.

Ajax-coding styles are still in the beginning phases, and the outlook is great. I honestly believe though that Ajax will be replaced by another form as the remote-scripting styles did as well. But learning it will provide you with the backbone knowledge for the future.

I believe that browsers will soon be equiped to work without the need of an ajax-style, but who knows. either way, ajax is here, and i'm glad to see another coder working to learn it. you'll have fun, trust me ;)
Post Reply