Book Review: Microsoft AJAX Library Essentials

Blogging on the Microsoft Community web site http://weblogs.asp.net has proven to be more rewarding than blogging on my own. I get more feedback from other developers. There have also been other benefits. For example, I was sent a free book to review. Microsoft AJAX Library Essentials: Client-side ASP.NET AJAX 1.0 Explained by Cristian Darie and Bogdan Brinzarea is a book on the Microsoft JavaScript library for AJAX. There are many AJAX JavaScript libraries available like script.aculo.us, jQuery, and Prototype but the Microsoft AJAX Library is designed to make the most sense to ASP.NET developers because it uses namespaces and classes that are similar to C# and the .NET Framework.

This book provides an excellent overview of the object-oriented programming capabilities of JavaScript. Most web developers just hack JavaScript without getting into its OOP aspects so there is a lot to be gained from this material. For instance, I learned that the proper way to create HTML code is through the Document Object Model using functions like createElement, createTextNode, and appendChild instead of just doing it the lazy way with innerHTML. JavaScript isn’t a proper OOP language so there are many work arounds to get it to emulate classes. Some of these language features are similar to what has been added to C# 3.0; anonymous functions, inner functions, closures, functions as variables, and prototypes. However you don’t really need to know all the insidious OOP details to use the library.

There is also some information in the book on JSON (JavaScript Object Notation) which the Microsoft AJAX Library uses to exchange data. Basically it is a way to serialize JavaScript object arrays as plain text. I’m not sure if the Microsoft AJAX Library will accept XML. When I tried to use it with YouTube gData I got an error and had to include the json query string variable &alt=json.

The book also covers all the debugging tools available for JavaScript. I did find a few I did not have like the Venkman JavaScript Debugger and Nikhil Kothari’s Web Development Helper. There is a debug version of the library, MicrosoftAjax.debug.js, which contains code comments, readable code, and summary data for Visual Studio 2008 code completion. The library itself contains a debug class with methods for debugging and tracing. I consider this an excellent reason to use this library instead of other AJAX libraries because I rely heavily on debug statements and tracing.

I tried to use the Microsoft AJAX Library in my custom help collection. The request went out but the response gave me an error, “Access is denied.“. I suspect this is caused by the same origin policy which prevents documents or scripts loaded from one origin from getting or setting properties of documents from a different origin. A web page in a help 2.0 collection frequently has problems in referencing files and does not exactly operate within a domain.

You can find additional information on this book at: http://www.packtpub.com/ajax-csharp-essentials/book

This entry was posted in ASP.NET, General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.