Geeks With Blogs
Geekette Mai Blog


What is Atlas?

The Atlas features of ASP.NET are not just another AJAX script library for writing client-centric Web applications. Atlas builds on the .NET Framework 2.0 and adds support for better utilizing the capabilities of client-side JavaScript and the XMLHttpRequest object. It includes server-based features that make it easy to enrich existing ASP.NET applications, as well as a client script library that is used by the Atlas controls and services. The architecture diagram in Figure 1 shows that the Atlas architecture extends across client and server and should be viewed as a broad set of development technologies for creating richer, more responsive cross-browser Web applications.

Figure 1 ASP.NET Atlas Architecture
Figure 1 ASP.NET Atlas Architecture

Scenarios enabled by Atlas are not limited to updating regions of the page with an asynchronous JavaScript call. You also get richer client experiences that would otherwise be impractical. For example, consider a Web application built around movie data. The application might want to allow users to search for a specific actor. Obviously it wouldn’t be practical to provide a comprehensive dropdown list of all actor names to choose from, so the application would probably break the problem down. Users might be asked to select the first letter of the actor’s name. A request to the server could then provide a list that would be somewhat more manageable, but the user experience is not great. The application could present the user with a textbox to enter in part of the actor’s name. The server would then at least have some data to use in narrowing the search. This is better, but still leaves room for improvement. With Atlas you could provide a textbox that reacts dynamically as the user types to help narrow the search without waiting for the browser to refresh the whole page. Figure 2 shows how you could use Atlas to add autocomplete behavior that provides feedback as the user types.

Figure 2 Filtering Combobox
Figure 2 Filtering Combobox

The Atlas CTP is available as a download from When installed, it adds an additional Web Site template for C# and Visual Basic® .NET to Microsoft Visual Web Developer™. When you create a new Web site project in Visual Web Developer (click File, then New, then Web Site), you will see a dialog like the one shown in Figure 3. The Atlas Web site includes Microsoft.Web.Atlas.dll and an updated web.config file that configures the Web application to be able to use Atlas-based ASP.NET features. In the current release, Microsoft.Web.Atlas.dll is placed in the bin directory of the application as a local assembly available throughout the application.

Figure 3 Creating an Atlas Web Site
Figure 3 Creating an Atlas Web Site

Atlas-based applications can be easily deployed by copying the files from a development machine to a server with ASP.NET 2.0 without worrying about separately installing Atlas. The installation is at the application level instead of machine level. As subsequent CTP releases become available, they can be used on a machine with older versions of Atlas even as the features evolve and change. This provides more flexibility in migrating to newer versions than if the installation were systemwide.

The Atlas Architecture

The first thing to notice about the Atlas architecture diagram shown in Figure 1 is that it spans both client and server. ASP.NET 2.0 added some additional client features but not to the extent that Atlas does. On the right side of the architecture diagram, notice that Atlas server features are built on top of ASP.NET 2.0 and extend its capabilities. Atlas includes a new set of server controls as well as new features aimed at accessing server-based data and services from the browser.

On the left you’ll see a comprehensive client script library, which can be used independently of the server features in writing client-centric JavaScript. It is the foundation on the client that is used heavily by the new Atlas features to enable richer application development with improved client-server interactions.

In Figure 4 you can see the typical client-server interaction in a Web application. First, a page is requested by the browser and the user interacts with it. When some action from the user requires data from the server, a complete page refresh occurs to update part of the page based on their input. Unfortunately, this behavior does not allow the user to continue interacting with the page. Instead, the user must pause continuously while working with the Web application.

Figure 4 Typical Client-Server Interaction
Figure 4 Typical Client-Server Interaction

Figure 5 shows that client-server interaction with Atlas shifts away from complete page refreshes. Instead, the initial HTML is retrieved and subsequent calls to the server get updated data in XML, JavaScript Object Notation (JSON), or snippets of HTML to update the page incrementally. The background asynchronous calls can invoke Web services or retrieve page changes without leaving users feeling that they must pause. These asynchronous calls manage updated view state information for subsequent server postbacks so that when a complete page refresh is necessary, the accurate state of the page is carried to the server.

Figure 5 Atlas Client-Server Interaction
Figure 5 Atlas Client-Server Interaction

The Client Script Core Library

The Atlas client script library is delivered to the browser as several distinct pieces. The script core comprises the bottom layers on which the rest of the library is built. At the base is the browser compatibility layer. A key feature of Atlas is that it will run on the modern browsers that support the key elements of AJAX. In the CTP builds, this support has included Mozilla Firefox, Apple Safari, and Microsoft Internet Explorer®. The browser compatibility layer is an abstraction that allows you to write script with less worry. It hides the details of where the browser implementations differ. It also allows for Atlas support to be easily augmented as the browsers evolve and as new versions are released. The type of browser making a request automatically determines what browser-specific parts of the compatibility layer are used. The higher-level code has been written to the abstraction layer, so you don’t need to code around variations in browser implementations.

On top of the compatibility layer is the core type system. The type system allows for an object-oriented approach to JavaScript development. It gives the developer working in JavaScript the ability to create namespaces and add classes to them. It also simulates object inheritance. There is support for interfaces, delegates, and enumerations, which makes it easier to switch back and forth between developing code on the server in an object-oriented programming language like C# and writing JavaScript code on the client.

The base class library layer built on top of the type system completes the core of the client script library. The concept is borrowed from the .NET Framework and exposes some familiar types. There is an Event object that supports multicasting of events in a natural way in JavaScript. There is a StringBuilder object, too. There is also support for object serialization, including support for JSON and XML data. The base class library also includes WebRequest and WebResponse classes that provide an abstraction over the browser’s XMLHttpRequest object similar to those found in the System.Net namespace in the .NET Framework. The code in Figure 6 demonstrates creating two simple types in JavaScript using the Atlas script core. The Movie type that is created first exposes properties for the movie title and its genre as well as a toString method. The Drama type then extends the Movie type and overrides the toString method.

The page that uses the Movie and Drama types is shown in Figure 7. It first references the .js file where the types are defined in an Atlas ScriptManager control. Then, in the Click handlers, the page creates instances of the Movie and Drama types and calls their toString methods. The inheritance behavior is what you would expect to see from any object-oriented programming language, but the code that is running happens to be dynamic JavaScript. Another nice aspect of the current Atlas installation is that debug versions of the client script library are included to make debugging and troubleshooting easier. Debugging JavaScript has always been cumbersome, so this may ease the pain.

Client Script Controls and Components

Above the layers that make up the client script core of the Atlas architecture are the component model and controls layers. This part of the script library builds on top of the script core underneath it, but is rendered to the client separately. You could choose not to include the component layer and instead just use the JavaScript type system and base class library directly when writing script, but you would not have access to the client components provided by Atlas and would not be able to use xml-script, which is a new set of declarative elements contained in the page markup that is sent to the browser. The xml-script elements are contained in a script tag that uses the new type value:

Posted on Friday, July 14, 2006 10:15 AM | Back to top

Comments on this post: What is Atlas?

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Mai Nguyen | Powered by: