How Silverlight Works

Bill Gates Image Gallery Bill Gates talks about Silverlight at the 2008 Consumer Electronics Showcase. See more Bill Gates pictures.

Robyn Beck/AFP/Getty Images

Browsing the World Wide Web has changed a lot since the early 1990s. Back then, most Web pages consisted of static text, a few images and the occasional looping (and often irritating) MIDI sound file. But the Web has grown more complex over the years. Today, you can visit Web sites that incorporate video, animation, sound and interactive features. With the most advanced Web sites, it's almost like getting pulled into a movie. But in order to build, view and interact with these new features, programmers have had to create new applications. One of those applications is Microsoft's program Silverlight.

Silverlight defies easy explanation. In many ways, it's similar to Adobe Flash. Silverlight requires developers and users to download a client -- Web browsers can't process Silverlight content without this download. It gives Web developers the ability to incorporate streaming video, audio and animation into Web pages. Programmers can create complex, user-interactive Web applications using Silverlight technology. On the World Wide Web, these applications have a special name: Rich Internet Applications (RIAs).

­As RIAs become more sophisticated, the difference between desktop applications -- programs that live on your hard drive -- and Web-based programs begins to fade away. Web browsers may eventually evolve into fully-fledged Web-based operating systems as we use the Internet to provide our data processing and storage needs. Leveraging the Internet in this way is called cloud computing -- programs and data live in the "cloud" of the Internet instead of on an individual user's machine.

Silverlight is just one of dozens of tools designed to help programmers create better RIAs. Microsoft engineers built Silverlight as an extension of other Microsoft projects, but the application itself stands on its own. Microsoft promotes Silverlight as a cross-platform, cross-browser technology. That means Silverlight applications should work on either PCs or Mac computers and within browsers like Internet Explorer, Firefox or Safari. Silverlight should soon work with Linux computers as well -- an open-source project called Mono is spearheading the effort to create a Linux version.

Although Silverlight is a young technology, it's no stranger to trouble or controversy. Some developers and users aren't keen on yet another Web technology that requires a downloadable plug-in to work. And a partnership with NBC during the 2008 Beijing Olympics might not have generated as much buzz as Microsoft hoped.

But before we jump into all of that, let's first take a closer look under Silverlight's hood.

  1. Silverlight Beta
  2. Silverlight Development
  3. Silverlight Applications
  4. Silverlight Video

Companies like engineering firm Thomas Wilmes are using Silverlight to build entire Web sites..

(HSW Screenshot -- no credit)

One of the tricky things about Silverlight is that there are, as of this writing, two versions: Silverlight 1 and Silverlight 2 Beta. Silverlight 1 supports applications written in the JavaScript programming language. The beta version of Silverlight 2 supports additional programming languages like C# (pronounced "c sharp") and Visual Basic. Both versions of Silverlight work within the .NET framework.

So what's .NET? It's another product from Microsoft. The .NET framework is a programming model. Programmers can build applications within this model -- particularly Web applications that rely on eXtensible Markup Language (XML).

The .NET Framework's two major components are a common language runtime and a class library. The common language runtime acts like an administrator -- it monitors applications and allocates the resources those applications need (like memory or processing power) to run properly. The class library contains several reusable software objects programmers can rely on while creating applications. A software object has two characteristics: state and behavior. An object's state refers to the different conditions the object can have. For example, a program could have the states of "running," "paused" and "stopped" (though not all at the same time). Behaviors refer to what an object can do. In our example, that would include "start," "pause" and "end."

And that's just the framework that surrounds Silverlight! Within Silverlight, Microsoft includes Windows Presentation Foundation (WPF) technology and support for eXtensible Application Markup Language (XAML). Application developers can use both WPF and XAML to create Web applications. Both WPF and XAML work seamlessly within the .NET framework. Microsoft developed WPF because Hypertext Markup Language (HTML) has limitations -- Web browsers are capable of executing functions that are too complex for HTML to support.

WPF uses a vector-based rendering engine to generate graphics for applications. It can support 2-D and 3-D graphics and provides developers with the means to power their applications by working within .NET. The main purpose of XAML is to give developers the means to tweak the appearance of their applications. Together, WPF and XAML define the look and behavior of a Silverlight application.

While WPF and XAML determine how an application looks and behaves, programmers use other computer languages to build the applications themselves. While Silverlight 1 supports only JavaScript, the beta version of Silverlight 2 supports several dynamic languages. Programmers build their applications using these languages while working within the .NET framework and use WPF and XAML to integrate the application into the Web browsing experience. All Silverlight applications run within a Web browser.

Let's take a look at the architecture for the Silverlight platform to see how these elements all work together to give programmers the platform they need to build RIAs.