March 12, 2009

Taking AJAX literally makes lousy Web apps

As little as possible should be the rule for JavaScript, which must play a supporting role to CSS and HTML

Taking AJAX literally, using JavaScript and XML to create a Web site or application, is not a best practice. Far from it. Developers coming to the Web from C-like languages stumble into the AJAX trap, and the result is bloated JavaScript payloads, page load delays for every page refresh, browser and client platform incompatibility, and user frustration. If putting too fine a point on it is what's required to put my point across, so be it: Web site developers should consider JavaScript to be their last resort, and where it is used, it cannot be used the way it typically is today.

The fact that you can write a Web page in a text editor makes some people believe that it's easy. Free JavaScript libraries and templates for wicked cool stuff like DHTML menus, browser type forking, forums, and AJAX animation make Web site and Web app authors think that no matter how big it is, if a page loads from their desk, all's well. In the majority case, no debugging, code coverage, testing, profiling, and other validation steps are applied to JavaScript. In all other languages, these things are not holstered until a page won't load. They're essentials that you use throughout a project.

[ JavaScript, Perl, PHP, Python, Ruby, and other dynamic languages are remaking the Web and bringing programming to the masses. Where should developers place their bets? See Dynamic programming futures. ]

I realize that such tools are hard to come by. A commercial tool, like those from Adobe and Microsoft, affords JavaScript developers facilities for traditional debugging, but at the cost of injecting unpredictably large amounts of client-side code into the project that only the specific tool can understand. Altering the page by hand can make the tool useless for further work on the page. And a commercial tool can't always follow you from one project, host, or employer to another.

Free JavaScript development environments do exist. One of them is even commercially validated, and unexpectedly, it's a browser. Apple's Safari and the open source WebKit browser are operationally identical not only as Mac and Windows browsers, but both have freshly acquired and uncommonly good JavaScript debugging and code profiling facilities (see my Safari 4 preview). These browsers also share a stellar accelerated JavaScript interpreter that makes the edit/run/debug cycle go faster. They are also the only browsers that deliver on CSS4 and HTML5 standards (with some elements that are proposed to the W3C standards body). Sites that are visually rich may start sprouting "best viewed with Safari" banners until other browsers catch up. The banner would also let users know that your site is optimized for iPhone.

additional resources
White Paper - How to Improve Delivery of Advanced Web Applications

White Paper

Virtual Workforce: The Key to Expanding The Business While Cutting Costs

Get the independent advice and expertise you need to support a virtual workforce.

Go inside:
The three-step approach to making a virtual workforce a reality.
The four flavors of client virtualization technologies.
The three key initiatives that solve IT challenges.
Download now »
White Paper: Successfully Secure Your Wireless LAN With Wi-Fi firewalls.

White Paper

Addressing Linux Threats Leveraging Fewer Resources

The increase in Linux popularity has increased the frequency and sophistication of malware attacks. Read this 2 page white paper now to learn how you can protect your Linux environment with real-time protection that is certified by all major Linux vendors.

Download now »
White Paper - The 2009 Handbook of Application Delivery

White Paper

The 2009 Handbook of Application Delivery

Ensuring acceptable application delivery will become even more difficult over the next few years. As a result, IT organizations need to ensure that the approach that they take to resolving the current application delivery challenges can scale to support the emerging challenges. This handbook elaborates on the key tasks associated with planning, optimization, management and control and provides decision criteria to help IT organizations choose appropriate solutions.

Download now »
White Paper - Is Your Backup System Outdated?

White Paper

Mid-range Storage Considerations

A common misconception is that mid-range storage requirements are dramatically different than that of a larger enterprise. Mid-range storage users may require less capacity, but they have similar functionality and management requirements. This ESG paper examines mid-range storage needs and reviews a new solution that adjusts size while retaining value, performance and functionality.

Download now »

Today's Headlines: First Look Newsletter

Find out what will be news for the day, with our first-thing-in-the-morning briefing.

©1994-2010 Infoworld, Inc.