Like HowStuffWorks on Facebook!

How Silverlight Works

Silverlight Beta
Companies like engineering firm Thomas Wilmes are using Silverlight to build entire Web sites..
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.