The most successful browser plug-in is Adobe Flash, which is installed on over 90 percent of
the world’s web browsers. Flash has a long history that spans more than ten years, beginning
as a straightforward tool for adding animated graphics and gradually evolving into a platform
for developing interactive content.
It’s perfectly reasonable for .NET developers to create websites that use Flash content.
However, doing so requires a separate design tool, and a completely different programming
language (ActionScript) and programming environment (Flex). Furthermore, there’s no
straightforward way to integrate Flash content with server-side .NET code. For example, creating
Flash applications that call .NET components is awkward at best. Using server-side .NET
code to render Flash content (for example, a custom ASP.NET control that spits out a Flash
content region) is far more difficult.
Silverlight aims to give .NET developers a better option for creating rich web content.
Silverlight provides a browser plug-in with many similar features to Flash, but one that’s
designed from the ground up for .NET. Silverlight natively supports the C# language and
embraces a range of .NET concepts. As a result, developers can write client-side code for Silverlight
in the same language they use for server-side code (such as C# and VB), and use many
of the same abstractions (including streams, controls, collections, generics, and LINQ).
The Silverlight plug-in has an impressive list of features, some of which are shared in
common with Flash, and a few of which are entirely new and even revolutionary. Here are
• 2-D drawing.
Silverlight provides a rich model for 2-D drawing. Best of all, the content
you draw is defined as shapes and paths, so you can manipulate this content on the
client side. You can even respond to events (like a mouse click on a portion of a
graphic), which makes it easy to add interactivity to anything you draw.
Developers don’t want to reinvent the wheel, so Silverlight is stocked with a
few essentials, including buttons, text boxes, lists, and a grid. Best of all, these basic
building blocks can be restyled with custom visuals if you want all of the functionality
but none of the stock look.
Silverlight has a time-based animation model that lets you define what
should happen and how long it should take. The Silverlight plug-in handles the sticky
details, like interpolating intermediary values and calculating the frame rate.
Silverlight provides playback of Windows Media Audio (WMA), Windows Media
Video (WMV7–9), MP3 audio, and VC-1 (which supports high definition). You aren’t
tied to the Windows Media Player ActiveX control or browser plug-in—instead, you
can create any front-end you want, and you can even show video in full-screen mode.
Microsoft also provides a free companion hosting service (at http://silverlight.live.
com) that gives you space to store media files. Currently, it offers a generous 10 GB.
• The common language runtime.
Most impressively, Silverlight includes a scaled-down
version of the CLR, complete with an essential set of core classes, a garbage collector, a
JIT (just-in-time) compiler, support for generics, threading, and so on. In many cases,
developers can take code written for the full .NET CLR and use it in a Silverlight application
with only moderate changes.
Silverlight applications can call old-style ASP.NET web services (.asmx) or
WCF (Windows Communication Foundation) web services. They can also send manually
created XML requests over HTTP and even open direct socket connections for fast
two-way communication. This gives developers a great way to combine rich client-side
code with secure server-side routines.
• Data binding.
Although it’s not as capable as its big brother, WPF, Silverlight data binding
provides a convenient way to display large amounts of data with minimal code. You
can pull your data from XML or in-memory objects, giving you the ability to call a web
service, receive a collection of objects, and display their data in a web page—often with
just a couple of lines of code.
Of course, it’s just as important to note what Silverlight doesn’t include. Silverlight is a new
technology that’s evolving rapidly, and it’s full of stumbling blocks for developers who are used
to relying on .NET’s rich libraries of prebuilt functionality. Prominent gaps include a lack of
database support (there’s no ADO.NET), no support for 3-D drawing, no printing, no command
model, and few rich controls like trees and menus (although many developers and
component companies are building their own). All of these features are available in Windowscentric
WPF applications, and they may someday migrate to the Silverlight universe—or not.