Book review: AJAX programming
I’ve recently started doing some AJAX programming including the PenguinGallery used for my photo galleries. Ajax isn’t actually a programming language, but is a name given to the technologies used to provide smooth interactive websites. It is actually the combination of Javascript embedded within the webpage and code on the server (often PHP) and the use of the XMLHttpRequest to provide a way for these two technologies to communicate with each other.
I have already done quite a bit of PHP programming, but it had been a long time since I had done any Javascript programming beyond the odd pop-up window (but for legitimate purposes – not annoying ads / spam which gives it a bad name). My old first aid quiz used to be completely in Javascript when I first created it back in 1996, but the language and technology have moved on a lot since then.
I bought two books on Ajax “Beginning AJAX with PHP” and “Bulletproof Ajax”. These concentrate on the Ajax aspects so I also bought “Javascript the definitive guide” to provide more on Javascript beyond the Ajax part. I’ve since also bought “PHP 5 Advanced: Visual QuickPro Guide” which has some info on Ajax, but as the important aspect to Ajax is in the Javascript side I have not discussed that further in this review.
I wouldn’t have normally bought multiple Ajax books covering the same subject at the full prices, although most likely would still have bought the Javascript book in addition to an Ajax one.
Beginning Ajax with PHP
This is the first book that I tried on the subject.
As the title suggests this book explains both the Javascript and PHP aspects, although requires the ready to have some knowledge about both (which is not surprising for a small specialist book).
I found that the book started quite well, but then went into large chunks of code which were not very well explained or commented. The initial connection was commented within the code and that comment was then included in every example, but in other places the comments were badly missed.
The examples are not explained very well and I found it difficult to follow the book. There are some useful examples in this book, but due to the difficulty following them I’d suggest a different book instead.
Bulletproof AJAX
Bulletproof Ajax is a much better book. It seams particularly thin at only 216 pages but the content is well explained and easy to follow.
As the title suggests the examples are designed to work well on all systems and provides fallback for when Javascript is not enabled or desired. This is achieved using progressive enhancement where functionality is added to those that support it but maintaining the maximum functionality in those browsers that don’t. The book refers to this as Hijax. This is certainly a good approach and is what I’ve used in the Ajax based photo gallery, but I think we have enough meaningless names without creating a new one.
There is very little discussion about the PHP used to provide the data at the back end which I don’t think is necessarily a bad thing. Where PHP is used in Ajax it is just standard programming and does not require PHP to do anything different between Ajax and standard PHP web sites (except perhaps ignore a few headers or output as XML depending upon your preferred implementation), as such PHP is adequately covered in any book on the subject.
Bulletproof Ajax provides an excellent introduction to Ajax and has enough to get you started in programming Ajax. Highly recommended.
Javascript the definitive guide
This book is the odd one out in that it’s a book on Javascript rather than Ajax. It does have a chapter dedicated to Ajax, but covers only the basics compared with the other books described above.
The definitive guide is a guide to programming Javascript for web based interactivity starting at the basics. This book reads like an old style text book in a very dry way. What the book lacks in ease of reading it makes up for in the amount in the book. It is very comprehensive covering all aspects of JavaScript.
The section on Ajax provides an explanation of the technology and examples of how to apply it but it’s not as readable as the other books mentioned.
This is one of those books that is worth having as a reference or if you are already an experienced programmer, but there are books that are much easier to follow if you are new to Javascript and/or Ajax.