Relevance Review #4: Head Rush Ajax


URL:http://blogs.relevancellc.com/articles/2006/04/12/relevance-review-4-head-rush-ajax

Relevance Review #4: Head Rush Ajax
Head Rush Ajax, from O'Reilly, by Brett McLaughlin.


Quick summary:Fantastic introduction to the basics of Ajax if you can stand the format. Have one copy for your team and hand it to the new programmers during their orientation.

The Head Rush (and Head First) series are wildly popular. I can't argue that. What I can't figure out, really, is why. I'll let my wife explain it for me. Honey?

My wife: Is that the next book you are reviewing? You're only on page 3. You're going to be up a while.

Me: It sure is. Head Rush Ajax. Nifty title, no?

My wife: I guess. Hey, tell them to get rid of the picture of that goofy guy over in the margin.

Me: Uhhhhh....[flips through rest of book really fast to demonstrate goofy guy on every page]

My wife: Don't people find that insulting?

Me: Uhhhhh........[doing best Butthead impersonation]

Yes, this is an homage to the Head Rush conversational style...its like a meta-review, see?

So, these series use informal language, tons and tons of pictures, lots of diagrams, and every font in the I-just-discovered-the-font-menu-in-Word-2003 pantheon. They explain this up front by saying that your brain really only pays attention to tigers. And Comic Sans, apparently. And, honestly, I can't argue with Brett or Kathy Sierra on this: they've sold a ton of books, and people seem to dig it. Let's just say that I could have used one less picture of the Project: Chaos guy who looks like a well-armed Devo fan.

As for content, it is hard to imagine a book that nails its target audience better. They say the book is for the programmer who has done a lot of HTML, and a little JavaScript and CSS, and no Ajax. They specifically say it isn't a reference book, nor for advanced programmers. They are right on both counts. Which is why we recommend having a copy to hand to every fresh face your Web 2.0 startup hires straight out of middle school or the J2EE Enterprise ecosystem.

I actually love the technical content here. Its a perfect primer for Ajax. They cover:

creating XMLHttpRequest objects across all browsers
Invoking them asynchronously and synchronously (with bonus material clearly delineating the two)
Harvesting the results while checking for readystate and status codes
Utilizing XML as the request/response payload
Extensive DOM navigation techniques
How JavaScript is loaded and parsed in a page execution context
JSON vs. XML for data transmission
Security issues like SQL injection and rogue eval() calls
It is the perfect beginner's mix of how to get stuff done without screwing up. In addition, the code is robust, and the descriptions are filled with helpful tips about the kinds of status codes you might expect, how to defeat IE URL caching, and little stuff that drives the beginning programmer crazy because they are hard to Google.
Unfortunately, because of the format, it takes a whopping 395 pages to get through that list, while another book would probably do it in under 50. Which is why, having read it now, I'll not crack its glossy, shiny, brightly colored cover again, much as I enjoyed the author's writing style, wit, and dedication to his craft.

Finally, at the end, there is a brief introduction to the idea of Ajax toolkits with a half-page example of "using" each. They hit the right candidates: Prototype, Script.aculo.us, Dojo and Rico, but they only focus on the abstractions wrapping around XMLHttpRequest (in Prototype and Dojo) or simple DOM access (Script.aculo.us and Rico) without even mentioning that these libraries do so much more. Dojo, in particular, needed at least a sentence describing it as the most ambitious JavaScript library ever created.

Probably the only other downside to this book is that all the server code is PHP. There is nary a mention of other server-side possibilities, and therefore no examples, either. Which means the text doesn't even mention the possibility of other kinds of Ajax apps (using remoting, or even code-centric Ajax). They also, strangely, don't mention SAJAX or XOAD, the two major PHP Ajax toolkits. If you're going to do an entire book on PHP and Ajax, and then have an appendix listing Ajax toolkits, it seems appropriate to mention the shaded part of the Venn diagram.

 
In all, I'd highly recommend this book to the new learner. Said learner should definitely have a little HTML background and have written at least a couple of lines of JavaScript. No CSS or DOM experience required. At the end of the book, that developer will be able to write simple Ajax apps, understand the value of Ajax frameworks, and draw a tiger from memory.

 

本文作者:
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3