Flash… no..oh.

 
I’ve been keen on doing some Ajax development for a long time now. Javascript is powerful enough to have lots of computation going on inside the browser (though only on a single thread) with callbacks to the server happening under control of this client code at appropriate points in the interaction sequence, without the GUI going dead while the callback happens. DHTML allows the display to be updated with a minimal amount of distraction (ie flashing) and CSS allows a number of quite sophisticated effects on the page. It’s great to find that we are now in a position where a web application can work cross-browser, with the changes required for particular browsers isolated in the library code.
 
This book is great and can be divided into four parts.
 
An introduction to the Microsoft Ajax library. This defines a pattern for using javascript to make it feel like a object oriented language in the mode of C#. Classes have instances which support interfaces, properties and events, with a means of interrogating instances and their classes for metadata. In order to do this, the library defines a standard pattern for Function object definitions, which then allow the library to ensure that the initialization happens along an inherited constructor chain. The book then goes into details of using the ScriptManager and UpdatePanels which allow partial page updates without the C# programmer having to do any non-server side code. Lastly the first part covers how server functionality can be exposed to client side script via ASP.NET web services.
 
Part two of the book goes into detail about what is happening behind the scenes in the implementation of the UpdatePanel. When using the UpdatePanel, there has to be an instance of a ScriptManger on the ASP.NET page. At runtime, this causes an instance of a PageRequestManager object to be constructed on the client. It is this instance that manages the page requests that are passed using asynchronous calls back into the server. The viewstate for the page is threaded through these calls to keep everything consistent, limiting the system to a single active call per page.
 
The ASP.NET Ajax framework allows the user to encapsulate functionality into controls and behaviours. Behaviours take an existing DOM element and extend it by hooking code into its events. An example of this would be something like an auto-completion extender for a text box. A DOM element could have multiple pieces of functionality added to it. Alternatively, full controls can be defined that consist of code that runs on both the client and server sides. The library makes the definition of such elements fairly straightforward with a well defined construction protocol and means to pass references to other items on the page into the javascript instance with the $create function.
 
The book then gives a brief introduction to the Ajax Control Toolkit which offers a wide range of useful components, from things like simple text box auto-completers to calendar controls to animation controls like FadeAnimation, ScaleAnimation and ConditionAnimation.
 
Part three of the book covers ASP.NET Ajax Futures. This covered two things: XMLscript and drag and drop. I found XMLScript very interesting. It allows javascript objects, defined with metadata on top of the Ajax library, to be connected via a declarative syntax, so that you could, for example, cause an update to a textbox to trigger an action. This all works by having an inbuilt XML parser that takes the XML and uses it to probe the various objects for their metadata and events – events can be subscribed to and properties can be set. Javascript functions can be composed into actions which may connected into this process.
 
Part four of the book covers other aspects of Ajax. Support for history and declarative data binding were interesting parts of this section.
 
This book was good because it showed how the technology could be used by way of some interesting examples, but also went in depth as to how the technology worked, and why it worked that way.
 
 
Advertisements
This entry was posted in Books. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s