O'Reilly logo

Programming Atlas by Christian Wenz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Atlas, Ajax, and ASP.NET

This book is about Atlas, the code name for a collection of new Microsoft technologies that enable web developers, particularly ASP.NET 2.0 developers, to create web sites with pages that use Ajax more easily. Ajax-style pages provide a richer interface to users, they are more responsive, because the page can react immediately to users, and they can interact more or less immediately with the server. Atlas also includes tools for creating mashups: web applications that combine content from multiple sites, typically using the APIs provided by third-party web services. We’ll be exploring all of these capabilities and more throughout the book; this chapter tells you how to get started with Atlas, paints a broad picture of the technologies involved, and explains how Atlas works from an architectural point of view.

Atlas and Ajax

Atlas builds on near-standard browser technologies, including Asynchronous JavaScript and XML. Ajax has itself generated quite a lot of buzz lately (see the "Preface" for some thoughts about that), since it can bring the functionality and UI of web applications closer to that of desktop applications.

The main idea behind Ajax is to enable web pages to make HTTP requests in the background, or asynchronously, without reloading an entire page (or, in ASP.NET terms, without a roundtrip or a postback). Ajax also provides the means to build a more responsive UI by drawing on the power of JavaScript, the Document Object Model (DOM), and CSS, all of which most browsers support. JavaScript, for example, is used to display the information returned by an HTTP request, without a full page refresh. Google Suggest (http://www.google.com/webhp?complete=1&hl=en) shows how an Ajax-enabled page can suggest words as a user enters text (also known as autocompletion). Another Ajax-style application is the Microsoft Virtual Earth site (http://www.virtualearth.com), which you’ll explore in Chapter 12.

One goal of Atlas is to help you create these types of Ajax-enabled applications by programming the browser (client). To work with the client side of Ajax and Atlas, you need a good knowledge of the core Ajax technologies. You need to know JavaScript and the DOM, and you need to know about the XMLHttpRequest object, which handles the requests from the client to the server. (Additional knowledge of XML and XSLT is a plus, but is not mandatory; we don’t use them much in this book.)

While Chapter 2 covers the essentials of JavaScript, you’ll learn about other Ajax technologies in greater detail in Chapter 3. To follow the example in this chapter (see "A First Atlas Example: Hello User“) all you need is a basic understanding of the Ajax technologies, and we’ll provide that as we go.

Writing Ajax-based applications without a framework like Atlas is not necessarily easy, and you can find yourself writing the same code over and over to perform tasks such as displaying the data returned from a request to the server, binding controls to data, or working with web services. You can also find yourself writing code to work around differences in how browsers implement the DOM. One of the goals of Atlas is to reduce or even eliminate the need for writing such code and to deliver a client-side developer experience that matches the experience of ASP.NET 2.0 developers. A related goal is to bring some of the productivity advantages of object-oriented programming (OOP) and of a framework like .NET to JavaScript. Therefore, Atlas includes client-script libraries that give the JavaScript/DOM/CSS programmer the following:

Browser compatibility layer

Allows Atlas scripts to run in most browsers and eliminates the need to handcraft scripts for each browser you want to target. (Some browser-specific script is unavoidable, however, as you’ll see in Chapter 3.)

Core services

Provides JavaScript extensions that make OOP-like scripting possible, including support for classes, namespaces, event handling, inheritance, some data types, and object serialization with JSON and XML. The most valuable of these extensions are discussed in Chapter 8.

Base class library

Provides a number of .NET-like components, such as string builders and timers. You’ll learn about the Atlas StringBuilder class in Chapter 8.

Script controls and components

Provides Atlas versions of standard HTML controls that are extended with capabilities like data binding, prepackaged behaviors (for example, drag-and-drop functionality), and tight integration with the Atlas 3lient libraries. You can program these controls and components directly, or you can use a new declarative markup called xml-script, which you’ll learn about in Chapters 5 and 6. If you are familiar with ASP.NET markup syntax, then you already understand (in general terms) the relationship of HTML controls, abstract programmable versions of these controls, and a declarative syntax.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required