Programming for Silverlight: a Q&A with Microsoft
We ask what it’s for and where it runs - and get several different answers
Depending on who you talk to at Microsoft, Silverlight is a way to design good-looking interfaces with Ajax, a way to stream your content or – in version 1.1 - a new programming model for developing cross-platform rich internet applications with real languages.
According to Keith Smith, product manager of the user experience platform and tools team at Microsoft covering Silverlight as well as WPF and tools like the new Expression Studio, Silverlight is designed “to provide a very lightweight implementation that can be distributed across platform in any browser, with a rich underlying programming model, aimed at those who have a penchant for dynamic languages but don’t like the limitations”.
John Richards of the Windows Live team uses Microsoft’s own jargon: “We talk internally about ‘devignders’ – people who spend half their time in developer tools and half their time in design tools” [just as long as no-one ever uses that word again in our copy – Ed].
As well as the library of controls in .NET “which mean that designing text boxes for your application doesn’t become a two day project,”, Smith thinks that the support for Microsoft’s in-line query language, LINQ, will work well for Internet application developers. “LINQ is a very commonsense way of accessing data regardless of the source; if you’re comfortable with the LINQ syntax you can copy and paste and share that syntax with Silverlight.”
But while Smith says Silverlight applications will use the available .NET libraries on any platform, Microsoft hasn’t yet finalised what the cross-platform libraries will be. “It’s not the full .NET but you get enough of .NET to create experiences that rival Web-server-only applications and begin to approach the Vista desktop experience around video playback and vector graphics. Our goal is to allow designers and developers to assume enough functionality in Silverlight to build the applications we’ve shown without you having to redistribute additional control libraries. There’s a fine dance you have to do to say how much functionality is a baseline and we’re still trying to figure that out.”
You can get an idea of what this baseline will be already, by looking at what isn’t in Silverlight; it doesn’t have the server garbage collector, the compilers or the whole of ASP.NET. The beta of Silverlight 1.0 is 5MB; the alpha of Silverlight 1.1 for the Mac is 10MB (which is both Intel and PowerPC code) and it takes 28MB once it’s installed. Silverlight applications will be small; the TopBanana video editing app demonstrated at MIX 07 was only 50K.
Smith believes that shows that “the strength of the XAML file format is that your user interface is built in; it’s just text so it compresses very, very well, rather than putting your code into an opaque binary object that doesn't compress well. And you can reuse your code simply by copy and paste”.
Custom controls won’t be re-used automatically by another application; there is no DLL-style mechanism in Silverlight and Smith says that having “two isolated applications sharing controls is currently not on the roadmap”, a process he calls “complicated and fraught”.
Users reloading an application may or may not have to download it again: “we build on top of the existing browser caching framework so you can set headers and MIME types on your content – images, video and animation effects – to cache it or have it reloaded.”
Files will be compressed when you turn your code into a Silverlight application; Microsoft is considering what Smith calls a ‘lightweight ZIP model’ for the format but you can also use HTTP serverside compression.
Because XAML is text, Silverlight applications will be easy to make accessible, Smith says. “Accessibility and localisation are areas where we think we have some very good solutions and tools support. Silverlight will adhere to all those standards and support screen readers but the most important thing is how easy it is for developers to discover [the accessibility options]. The pattern we follow with Ajax is to make smart decisions on behalf of the designer and developer – so if you set the caption on a button we make sure that caption is copied automatically to the appropriate metadata. And where we can't make a decision on your behalf, we offer a quick way to set up accessibility through our tools. We have an accessibility checker for ASP.NET and Ajax and we want to do the same thing for Silverlight. But where we can put the processing burden on the computer, we want to do that.”
The security model for Silverlight is the browser-based sandbox; and the sandbox will be the same on the different platforms Silverlight runs on. Beyond that, says Smith, the Silverlight team is looking for ways to make cross-domain data access easier: “The challenge there is one of protecting the user."
Smith continues: “Most cross domain issues today are addressed by putting some code on your domain and using as a proxy. With things like LINQ, you have the option of grabbing the logic, sticking it into a relational database on the server and sending it as a JSON array back to the client; with Silverlight, you can push the exact same logic back to the client. If you’re developing in Iron Python today it’s a seamless transition to developing the same way on the client side.”
There’s more browser support on the way, including Opera; but there’s no roadmap for Silverlight running directly on other operating systems without being hosted in a browser. When Smith says Microsoft has “blurred the line to go from the browser to the desktop to the sidebar to Office”, he’s talking about using the same skills and tools for development, not the same code. “We want to take our heritage and our strength in this emerging market of RIAs into the cross platform world; so we blur the line to go from the Web platform to an RIA with your existing skills; you can use Ajax if you’re familiar with it, but you can also use Python, C# or VB if you’re familiar with those.”
The next platform Silverlight will reach is the mobile phone, and according to John Starkweather, the Group Product Manager of Microsoft’s Mobile and Embedded Devices division, that’s not just for Microsoft phones: “We will have an offering for Windows Mobile as well as for other phone platforms as that makes sense: we’re working on it and there will be a beta available this year.”
Sponsored: Quit your addiction to storage