Book Review: Microsoft AJAX Library Essentials

Microsoft AJAX Library Essentials: Client-side ASP.NET AJAX 1.0 Explained

by Cristian Darie, Bogdan Brinzarea

This book provides in-depth coverage of the Microsoft client library for AJAX. I didn't even know Microsoft had a JavaScript library but you can download it at: http://asp.net/ajax/downloads/library/ You can use the Microsoft AJAX Library with whatever server technology you wish including PHP or Java. There are many AJAX JavaScript libraries available but this one is designed to make the most sense to ASP.NET developers because the API will be similar to C#.

The first few chapters of the book provide an extensive introduction to the object-oriented programming capabilities of JavaScript. Most web developers just hack JavaScript without really learning the language so there is a lot to be gained from these chapters. 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. It irked me that I did not know that but I've since found innerHTML still being used in Microsoft source code so you see a lot of bad usage.

JavaScript isn't really a proper OOP language so there are many work arounds to get it to emulate classes. Some of these language features seem to have been added to C# 3.0 like anonymous functions, inner functions, closures, functions as variables, and prototypes. Don't ask me to explain any of that because it makes my head spin. However you don't really need to know all the insidious details to use the library, though I would recommend this book as an excellent resource if you wanted to understand JavaScript OOP.  There is also some information on JSON (JavaScript Object Notation) which the Microsoft AJAX Library uses to exchange data. JSON has been on my programmer radar because I found it used in some MediaWiki code when I was investigating wiki security. Basically it is a way to serialize JavaScript object arrays as plain text.

The final chapter of the book covers all the debugging tools available for JavaScript which most web developers already know about and recommend. 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 Microsoft.Ajax.js library 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 have not been using AJAX much in my custom web application development. However, I would like to see if the Microsoft AJAX Library is suitable for developing widgets and gadgets which usually require creating the XMLHttpRequest object. I'm also going to try using it in my custom help collection. I already have several JavaScript libraries baked into my notes including; base64.js, swfobject.js,  jsTrace.js,  json.js, styleswitcher.js, and shadedborder.js.

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

 

No Comments