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.

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.

Silverlight Development

Microsoft hosts a special forum Web site where Silverlight developers can ask questions and trade tips..
Microsoft hosts a special forum Web site where Silverlight developers can ask questions and trade tips..
(HSW Screenshot -- no credit)

Like all software, the Silverlight platform has a particular arrangement of functions and features called an architecture. A program's architecture can tell you a great deal about how the program works. It groups tasks together in a logical way and shows how the different parts of a program work together to provide the overall service. Microsoft's goal with Silverlight is to create a powerful but simple platform for the next generation of Web-based applications.

Microsoft divides the Silverlight platform's architecture into two major components with an additional installer and update element. The two major components include a core presentation framework and the .NET framework for Silverlight. Let's look at each in turn.

The core presentation framework contains the following:

  • A user interface (UI) rendering engine, which generates all the graphics, animation and text within an application
  • An input interface that handles user input from devices like keyboards, mice and digital tablets
  • A media engine that supports several audio and video file formats
  • A digital rights management element that allows developers to maintain control over media within their applications
  • Support for customizable application controls
  • Support for dynamic UI layouts -- this feature allows developers to change the appearance of an application's UI in real time
  • Support for data binding -- linking UI elements to data objects within an application
  • A parser for XAML

The .NET Framework has the following features:

  • Support for Language-Integrated Query (LINQ) features -- LINQ allows developers to integrate data from different sources
  • A base class library that supports fundamental programming functions such as cryptography
  • A suite of features called the Window Communication Foundation (WCF) designed to make it easy for an application to access remote data and services
  • The Windows Presentation Foundation (WPF)
  • Dynamic Language Runtime (DLR), the element that supports applications written in various programming languages
  • Common Language Runtime (CLR), the component that handles memory management and other critical functions

The presentation core and the .NET Framework interact with one another primarily through XAML. In a way, XAML acts as a bridge between the two components. The installation and updater element is pretty self-explanatory. It's supposed to make the initial installation of an application as smooth as possible for the user. It also provides a framework for automatic application updates.

In addition, Silverlight has a few other features that help developers create RIAs. Many of these functions focus on data security and application management. There are file management features, an isolated storage function and XML libraries, to name a few.

Next, we'll look at the kinds of applications Silverlight developers will be able to build.

Silverlight Applications

The Echo myPlace application uses Silverlight to tie news stories to geographic locations.
The Echo myPlace application uses Silverlight to tie news stories to geographic locations.
(HSW Screenshot -- no credit)

The applications of Silverlight are nearly limitless. Silverlight's tools allow developers to create Web-based programs that range from utilitarian devices to challenging video games. Even though Silverlight is still a relatively young programming platform, there are dozens of applications already available on the Web.

It's not surprising that developers are using Silverlight to create streaming media players. The media players are similar to Flash media players -- the kind of applications used by Web sites like YouTube. These programs stream video and music from the Internet to a user's browser. Silverlight lets developers create themed video players that provide specific content. For example, the Futbol Mexicano Silverlight application streams video of Mexican soccer games to users. But Silverlight can do more than play videos.

Silverlight applications can be relatively simple, like hero bars. Hero bars are Web banners that feature blurbs and links to content found deeper in the Web site. Developers can use Silverlight to create a hero bar that can pull information and links from an RSS feed. The hero bar updates itself as the webmaster adds new content to the site.

Programmers can also use Silverlight to interact with other Web services. Twitterlight is a Silverlight application that taps into the Twitter microblog service. With Twitterlight, users can access their individual Twitter feeds and post new messages.

Buzzoggi uses Silverlight to gather hot topic key words from several news RSS feeds and display them in a cloud. Buzzoggi uses Silverlight to gather hot topic key words from several news RSS feeds and display them in a cloud.
Buzzoggi uses Silverlight to gather hot topic key words from several news RSS feeds and display them in a cloud.
(HSW Screenshot -- no credit)

The TeamLive online productivity software application lets Silverlight users work together on projects. TeamLive gives users the ability to take screenshots of applications or Web sites and share them with other users. This makes collaboration among team members in different locations easier. The team can work together in real time to fix problems or streamline designs.

Games running on Silverlight can range from the simplistic to immersive adventures. For example, you can find traditional games like Hangman in Silverlight form, but you can also find arcade-style games such as Zero Gravity, a space-themed adventure game. Like Flash, Silverlight gives developers the resources necessary to create robust gaming experiences that users can access through a Web browser.

These applications are just the tip of the iceberg. As the Web becomes more sophisticated and people get access to more bandwidth, users will demand more from their browsing experiences. An increasing number of people are turning to the Internet for news, entertainment and productivity applications. Developers will have to use tools like Silverlight to meet consumer demand.

Silverlight has already made a big splash through a few strategic partnerships with more traditional media. We'll take a closer look at these relationships in the next section.

Silverlight Video

NBC used Silverlight to broadcast Olympic events over the Web to certain users in the United States.
NBC used Silverlight to broadcast Olympic events over the Web to certain users in the United States.
(HSW Screenshot -- no credit)

Bill Gates was the main keynote speaker at the 2008 Consumer Electronics Showcase (CES). The speech marked his final CES presentation as chairman of Microsoft. That evening, Mr. Gates unveiled many new Microsoft projects, products and services. Among them was a partnership with NBC to broadcast the Olympics online within the United States.

NBC had already obtained the television rights to broadcast the Olympics in the United States. In addition to traditional televised broadcasts, NBC, along with Microsoft, offered Olympic coverage online at its Web site. Visitors had to download and install Silverlight to their computers in order to watch the video. Some tech journalists questioned the decision -- while Silverlight is a powerful platform, Adobe Flash has a much larger presence in the market. Most PCs already have Flash and comparatively few people had downloaded Silverlight. It seemed to some journalists that NBC was conducting a risky experiment.

Was the pairing a success? That depends on who tells the story. According to an article in The New York Times, NBC's Olympics Web site provided more than 72 million streams of video to viewers during the Olympics [source: Stelter]. But blogs like TechCrunch contend that other sites covering the Olympics -- sites that didn't feature any video at all -- had more visitors than NBC's site [source: Schonfeld]. Some blogs also reported rumors that advertisers weren't happy with NBC's online performance.

Perhaps NBC would have had more online viewers if the company had chosen Adobe Flash as its streaming video platform. Or maybe more people would have viewed the games on the Web if NBC hadn't limited the events broadcast online. But even if some called the experiment disappointing, Microsoft knows that millions of people downloaded Silverlight. In Microsoft's book, that counts as a win.

Microsoft has formed partnerships with other big names in the United States. In late 2007, Major League Baseball's streaming video player switched to Silverlight. CBS chose Silverlight when the company created an interactive Web platform for user-generated content. And the National Basketball Association chose Silverlight for its online media player as well.

Will Silverlight become the next big Internet standard? It's still too early to tell. You might argue that it's more robust than Adobe Flash, but then again Flash has a much deeper penetration in the market. Ultimately, whichever technology comes out on top will provide users with what they want: an immersive Web browsing experience.

To learn more about Silverlight and related topics, shine a light on the links found on the next page.

Related HowStuffWorks Articles

More Great Links

Sources

  • Cooper, Charles. "We all love this Olympics, right? Not Adobe." CNet. Aug. 14, 2008. (Sept 10, 2008) http://news.cnet.com/8301-10787_3-10017507-60.html?tag=nefd.top
  • Frommer, Dan. "Adobe: Silverlight Who? Flash Video Dominated Olympics Worldwide." Silicon Alley Insider. Aug. 27, 2008. (Sept. 9, 2008) http://www.alleyinsider.com/2008/8/adobe-silverlight-who-flash-video-dominated- olympics-worldwide-adbe-msft-
  • LaMonica, Martin. "Silverlight on Linux? We're in, says Mono founder." CNet. May 1, 2007. (Sept. 10, 2008) http://news.cnet.com/8301-10784_3-9714669-7.html
  • Learmonth, Michael. "NFL, NBC Tap Adobe's Flash For Live Football." Silicon Alley Insider. Sept. 4, 2008. (Sept. 10, 2008) http://www.alleyinsider.com/2008/9/nfl-nbc-tap-adobe-s-flash-for-live-football
  • MacDonald, Matthew. "Silverlight 2 Visual Essentials." Apress. 2008.
  • MacDonald, Matthew. "Silverlight and ASP.NET Revealed." Springer. 2007.
  • Matyszczyk, Chris. "Are online advertisers disappointed in NBC's Olympic performance?" CNet. Aug. 18, 2008. (Sept. 10, 2008) http://news.cnet.com/8301-17852_3-10018721-71.html
  • Microsoft Developer Network. ".NET Framework Programming in Visual Studio." November 2007. (Sept. 9, 2008) http://msdn.microsoft.com/en-us/library/k1s94fta.aspx
  • Microsoft Development Network. "Silverlight." 2008. (Sept. 8, 2008) http://msdn.microsoft.com/en-us/library/bb188743.aspx
  • Microsoft Development Network. "Windows Presentation Foundation." November 2007. (Sept. 8, 2008) http://msdn.microsoft.com/en-us/library/ms754130.aspx
  • Microsoft Silverlight. "News." (Sept. 10, 2008) http://www.microsoft.com/silverlight/news/default.aspx
  • Moroney, Laurence. "Beginning Web Development, Silverlight and ASP.NET AJAX." Apress, 2008.
  • Schonfeld, Erick. "No Matter How NBC Spins It, Olympics Web Strategy Comes Up A Loser." TechCrunch. Aug. 25, 2008. (Sept. 10, 2008) http://www.techcrunch.com/2008/08/25/no-matter-how-nbc-spins-it-olympics- web-strategy-comes-up-a-loser/
  • Stelter, Brian. "Web Audience for Games Soars for NBC and Yahoo." The New York Times. Aug. 24, 2008. (Sept. 10, 2008) http://www.nytimes.com/2008/08/25/sports/olympics/25online.html
  • The Java Tutorials. "What Is an Object?" Feb. 14, 2008. (Sept. 10, 2008) http://java.sun.com/docs/books/tutorial/java/concepts/object.html
  • Wenz, Christian. "Essential Silverlight." O'Reilly. 2008.
  • Wildermuth, Shawn. "Getting Started with Silverlight." O'Reilly. 2007.