| By Kurt Cagle | Article Rating: |
|
| March 8, 2007 09:45 PM EST | Reads: |
6,287 |
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs for the special pre-order price, click here for more information. Aimed at everyone from enterprise developers to self-taught scripters, Real-World AJAX: Secrets of the Masters is the perfect book for anyone who wants to start developing AJAX applications.
AJAX isn't so much a single technology as it is a set of technologies that are now all part of most contemporary browsers. Because of this factor, it's sometimes difficult to explain what precisely AJAX is, especially the degree to which XML or JavaScript predominates.
This chapter will explore most of the canonical elements of AJAX on the client and get into some of the grittier details about how exactly an AJAX application works. It will also stray a bit off course and show how AJAX applications can use some of the more advanced capabilities on browsers (such as XPath and XSLT) to simplify the underlying development process, though perhaps at the cost of some portability.
The Essential AJAX Pieces
This should be a no-brainer. AJAX stands for Asynchronous JavaScript and XML so it stands to reason that AJAX would have both of these as core pieces (and it does, though interpreting the role of XML varies considerably from user to user in the AJAX space). However, AJAX generally involves considerably more than just these two technologies.
On the client, in particular, what has come to be called AJAX can best be broken down into the following areas:
JavaScript: This provides the scripting language for performing most of the actions (and generally for setting up event management).
XMLHttpRequest: This particular component makes communication between the client and server
possible from within a Web page.
HTML/XML Document Object Model: This provides a way of describing a Web page as a tree of
interconnected objects.
Cascading Style Sheets (CSS): This language makes it possible to change the visual styling of the page to alter its presentation layer.
Besides these four elements, there are two more that are found in Internet Explorer and Mozilla Firefox:
XSLT: This transforms XML content into other XML content and works quite effectively for building rich objects from data streams.
XPath: This provides a way of navigating around complex XML structures more readily.
These will be covered in greater depth at the end of this chapter.
Whole books have been written on all of these topics, so my goal here is not to teach the basics of JavaScript, DOM programming, or CSS. Instead, I'll be looking at those techniques that may be a little more advanced, but hopefully also be of more use to you as developers. Please check out the references at the end of this book for more information on each of the core technologies.
Examining JavaScript
JavaScript (or ECMAScript, as it's formally known) has been around in various forms since early 1994. It's found in all contemporary Web browsers, and in slightly modified form in the Macromedia/Adobe Flash player, in Adobe PDF, and as a scripting language on both Windows- and Linux-based systems. It's used as the binding language of choice in the Mozilla Firefox and Thunderbird applications
Despite this fairly impressive use record, until comparatively recently JavaScript has been maligned as being too lightweight to be useful in real-world applications, but its gradual re-emergence as part of AJAX has left those JavaScript developers who understood the power of their "light" language feeling more than a trifle smug.
While it's easy to look at JavaScript as being, as its name implies, a scripted variant of Java, this impression is in fact somewhat erroneous. Java is a strongly typed language with an elaborate inheritance mechanism and a foundational class system with classes numbering in the thousands. It has only recently branched into type templates and reflection.
JavaScript, on the other hand, views classes as being particular variants of functions, envisions objects as little more than bundled collections of properties and methods, dynamically assigns type depending on the context, and has only a handful of "core" objects and no foundational class system to speak of. Indeed, while it's possible to inherit classes in JavaScript, in point of fact it's usually far more effective to keep inheritance down to an absolute minimum.
These differences have made for very different ways of programming JavaScript compared to Java. Add to this the question of scope – JavaScript is typically used to automate Web page manipulation and, as such, is generally far more transient than most Java applications – this leads to a situation where the best way to learn JavaScript seriously is to forget that you ever learned Java and take it from scratch.
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs, click here to order.
Published March 8, 2007 Reads 6,287
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Kurt Cagle
Kurt Cagle is a developer and author, with nearly 20 books to his name and several dozen articles. He writes about Web technologies, open source, Java, and .NET programming issues. He has also worked with Microsoft and others to develop white papers on these technologies. He is the owner of Cagle Communications and a co-author of Real-World AJAX: Secrets of the Masters (SYS-CON books, 2006).
- Ubuntu-based Open Source Linux Mint Tests KDE Version
- Linux Virtualization and Tired Open Source Myths
- IGEL Supports Red Hat Enterprise Virtualization 3.0
- CloudLinux Announces Support for Atomia
- Amazon Kindle Fire Gets Its Own 'Personal Cloud Desktop' with AlwaysOnPC App Launch
- SPIRIT DSP Receives 2011 INTERNET TELEPHONY Product of the Year Award
- Hadoop Quickstart: Use Whirr to automate standup of your distributed cluster on Rackspace
- Jury Gets Novell Antitrust Case Against Microsoft
- The Utility Infrastructure Security Market 2012-2022: Cybersecurity & Smart Grids
- FORTUNE Magazine Names Rackspace Among “100 Best Companies to Work For”
- EnterpriseDB Announces Availability of Postgres Plus Cloud Database
- iFollowOffice Turns to Virtual Bridges and Savvis for On-Demand Virtual Desktop Services
- i-Technology in 2012: Five Industry Predictions
- Ubuntu-based Open Source Linux Mint Tests KDE Version
- Amazon to Rent Out Supercomputers
- Amazon Émigré Starts Network Monitoring Firm
- HP’s Putting a Back Door in the Itanium Alamo
- Linux Virtualization and Tired Open Source Myths
- CloudLinux Announces Preferred Partner Program
- MapR Pushes the Hadoop Envelope
- Rightware Announces Gaming Performance Benchmark for OpenGL ES 3.0/Halti
- IGEL Supports Red Hat Enterprise Virtualization 3.0
- CloudLinux Announces Support for Atomia
- 3Dconnexion Announces its Newest 3D Mouse - the SpaceMouse Pro
- The i-Technology Right Stuff
- Linux.SYS-CON.com Exclusive: Linus Discloses *Real* Fathers of Linux
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- A Closer Look at Damn Small Linux
- Linus' Top Ten SCO Barbs
- SCO CEO Posts Open Letter to the Open Source Community
- Netscape Co-Founder's 12 Reasons for Growth of Open Source
- Where Are RIA Technologies Headed in 2008?
- *POINT - COUNTERPOINT SPECIAL* What's Wrong with the Open Source Community?
- Introducing "Cooperative Linux" - Linux for Windows, No Less
- Linux.SYS-CON.com Exclusive: What Would UserLinux Look Like?
- Why Recovering a Deleted Ext3 File Is Difficult . . .



















