Microsoft's Silverlight 4 - more than Flash envy
MeeGo to phones, set-tops, and beyond
2010 is proving to be a big year for Silverlight, Microsoft's cross-platform browser plug-in.
"Four releases in two and a half years," said vice president Scott Guthrie at the launch  of Silverlight 4.0 this month, and as Microsoft reveals more pieces of its strategy, the rationale for this energetic development is also emerging. It's more than just Flash-envy.
Silverlight is the main development platform for Windows Phone 7 - the other being the games-focused XNA - and Microsoft has plans for Silverlight on other devices, expanding its existing web role.
In this context, it was interesting to hear Intel describe its ambitions for the Linux-based MeeGo, a joint project with Nokia, which extend to SmartPhones and televisions as well as netbooks.
At the recent Developer Forum in Beijing, Intel said it is bringing Silverlight to MeeGo in October, apparently using Microsoft's code rather than the open-source Moonlight project.
The Silverlight platform has several components. The runtime is a browser plug-in that runs on Windows with Internet Explorer, Firefox, or Chrome, or on Intel Mac with Firefox or Safari. The download is around 6MB, and it includes video and audio capabilities along with a cut-down version of the .NET Framework, enabling applications to be written in C#, Visual Basic, or other .NET languages.
Silverlight visual designer in Visual Studio 2010
Graphics and layout in Silverlight are defined using XAML, an XML language also used by Windows Presentation Foundation (WPF). Silverlight 3.0 introduced the ability to run as a desktop application, though one that is sandboxed from local resources.
Silverlight is supported on the server by media streaming services and by middleware called WCF RIA Services, which simplifies authentication and data access. RIA Services integrate with ASP.NET on the server and with the Silverlight client framework.
Ever since the first release in 2007, Microsoft has been frantically plugging the most obvious holes in Silverlight's capabilities. New features in version 4.0 include printing, bi-directional text, rich text box for formatted text entry, deep linking so that an external URI can point to an internal page within Silverlight, data input validation, right-click support, clipboard access, drag and drop, webcam and microphone support, and digital rights management for offline content (just what you wanted).
Out of browser applications are much improved, with a WebBrowser control and a notification API. There is a new option for trusted applications, subject to user consent, which gives file system access and, on Windows only, the ability to call native code via COM interop. Trusted applications can also make cross-domain network calls, which means for example a Twitter client is now possible.
Print this, or not...
It is all very well listing these features, but some are poorly implemented. Printing, for example, is based on sending a bitmap to the printer, not vector fonts or graphics, which means low quality. The WriteableBitmap introduced in Silverlight 3 is too basic. WebCam support is a start, but there is no codec writer to compress the video stream for sending over the internet.
Despite these and other flaws, Version 4.0 is still a substantial improvement. In addition, the development story is better following the release of Visual Studio 2010. Silverlight has two official authoring tools, Visual Studio for code and Expression Blend for design. Blend is capable but complex, and it's not a tool that developers are likely to pick up quickly.
Visual Studio 2008 had no visual designer for Silverlight, which meant either learning Blend or hand-rolling XAML. Since XAML is horribly verbose, it was a tough choice. The new Visual Studio has a two-way visual designer that is fine for business applications.
It may seem a small point, but this one feature significantly lowers the barriers for Silverlight development. Visual Studio's ability to combine server and client code in one solution and debug both seamlessly is another advantage. Note that both Blend and the Silverlight tools for Visual Studio are at Release Candidate status, and only the runtime is fully released.
Expression Blend 4 - capable but tricky to learn
Some things count against Silverlight. One problem is that designers generally prefer Adobe's tools, often on a Mac, whereas Silverlight authoring requires Expression Blend and Windows. Blend can import from Photoshop, but it is still an issue. Another snag is that the Silverlight runtime is less widely deployed than Flash and equally unlikely to make it to Apple's iPhone or iPad. Moonlight offers some Linux support, but tends to lag Microsoft's implementation.
You can use Silverlight to create annoying little animations for web pages, but a fair proportion of those browsing the web will not see them. The fact that Microsoft has added the Windows-only COM interop feature is also a concern, casting doubt on its cross-platform commitment.
The more capable Silverlight becomes, the more attractive it is as an alternative to a Windows-only client. The .NET runtime performs well, somewhat better than before in this release. There is also strong third-party component support from the likes of Telerik, DevExpress, Infragistics, and ComponentOne.
There is no doubting Silverlight's ability to support sophisticated and good-looking applications, and it is especially strong for data visualization. Microsoft has come a long way since 2007, when .NET and WPF were Windows-only technologies, and Silverlight 4.0 with Visual Studio 2010 forms an excellent RIA platform.
However, it is application development, rather than video streaming or web site decoration, which is its greatest strength. ®