Saturday, 17 July 2010

Silverlight Overview

Recently, I worked on a project that involved the use of Silverlight. This entry provides a brief over of the technology, and an intro into some of the sub-topics that it encompasses.

Simplifying the topic a great deal, Silverlight is .Net’s competitor technology to Adobe Flash. Just like Flash, it can be used to provide rich interactive content such as applications and games, as well as rich static content like streaming video. Also like Flash, Silverlight’s initial adoption has been slow, with few websites presently using it as their main solution delivery technology. At the time of writing this article, Silverlight is in its fourth generation of evolution. That means that a lot of Microsoft research and development time in recent years has gone into a technology that isn’t, as yet, being received by a wide audience.

The technology itself isn’t what’s holding back adoption; the solutions it enables developers to provide are pretty impressive as rich internet experiences go. What has been inhibiting progress to date is the age-old problem of internet development: site owners typically want to make their content available to the largest audience share possible. To satisfy this, developers therefore typically prefer to build using established technologies that are already being received by a high percentage of their target User base. As a corollary, developers acquire more skills in those older technologies, which ultimately go on to become ‘golden hammer’ solutions to the problem of presenting content via the web: if the only solution developers are familiar with is a hammer, then every problem begins to look like a nail. It takes at least one truly ground-breaking site that provides significant additional gains for its Users, such as YouTube,  in order to push a given technology over the edge from being kooky but great, to being mainstream and the new norm that Users don’t just adopt, but expect, and that developers are eager to immerse themselves in and use to expand the possibilities of what they can provide. Silverlight has yet to find its YouTube.

Microsoft has encouraged the adoption of Silverlight by licensing it to small, innovative technology companies, who, in return for adopting the technology to build the solutions they provide, get to use the latest development toolsets for a fraction of the fee that those same tools would cost larger organisations. In the process, Microsoft hopes that a greater percentage of the developer community will become familiar with the technology, and that at least some of these early-adopter organisations will provide that ‘YouTube Value’ that encourages end user adoption.

The development tools themselves are intended to form a bridge between the related but until now often separate activities of abstract visual design, and underlying software engineering. Tools in the suite that supports Silverlight include Expression Blend (often abbreviated in its current release to EB4). EB4 is a tool primarily aimed at designers, that is often used by developers too (you’ll typically find developers with a Silverlight solution open in Visual Studio for coding on their main monitor, and the same solution open in Expression Blend on their second monitor for visual reference). Expression Blend allows designers to set the style of visual elements against actual .Net controls, rather than against abstract graphic designs as has often been the case in many types of designer/developer collaborative effort up until now. Blend is capable of opening an actual Visual Studio solution, facilitating the editing of visual aspects of the controls and assemblies therein in real time, and allowing designers to save those visual updates back to a project that is shared with their developer colleagues via TFS. For the first time, designers and developers are able to access the same source, for different purposes, collaboratively instead of independently. The Expression Blend integrated development environment looks like this:

You can see objects in various stages of design and development within the main window, either as a visual representation, as XAML alone, or in a split view displaying both formats as shown below:

The extensive use that Silverlight makes of XAML is the first real difference that you notice as a developer with a background in .Net technologies like VB, C# and ASP.Net. (Coincidentally, XAML is also used by WPF – Microsoft’s replacement development platform for Windows Forms – so time spent getting up to speed with Silverlight also helps developers in gaining familiarity with WPF). XAML fills a role broadly equivalent to that which Windows Forms Designer Files did for Forms development, and HTML Markup did for ASP.Net. That is, it stores the basic visual design of a given component, by declaring which sub-components exist, and what values public Properties of those components will initially be set to. Just like ASP.Net and Windows development, Silverlight controls also have a code behind page, where developers can add interaction and function to the visual designs produced in conjunction with designers.

That’s it for this brief overview. In future posts, I’ll be delving deeper into the specifics of how XAML looks, and how it works in conjunction with code behind pages to produce fully-interactive designs.