On December 5th, 2007, Microsoft announced an incubation project they have been working on called Volta (http://labs.live.com/volta). The announcement focused on a new way of deploying applications written using conventional single-tier architecture to a multi-tiered client/server environment without having to rewrite the code. Along with the announcement, Microsoft posted a preview version of the Volta infrastructure for people to start experimenting with. This is not an official CTP or beta, simply a way for people to get an early view of what Microsoft is exploring and to be able to provide feedback.
The software preview requires Visual Studio 2008 and adds a number of new Volta project types:
The included samples are all web based and show off one of the main features of Volta: the ability to write an application in C#, and then have the Volta toolkit post-process the compiled code into JavaScript. This allows the application to run as a standard HTML-based web application, while still allowing the developer to build it in a comfortable environment. This feature is very similar to the Google Web Toolkit (GWT), which attempts to solve many of the same issues. However, Volta is far more ambitious as this article will demonstrate.
IL Re-Writing
The real technology that Volta encapsulates is IL re-writing. As you are probably aware, in the .NET world, the compiler’s job is to translate your source code into Intermediate Language (IL) code. This IL is then just-in-time (JIT) compiled into executable code at runtime. The IL itself is a very simple stack-based byte code which is easy to verify and easy to translate into executable code – a critical requirement if you are going to compile it at runtime!
IL re-writing examines the compiled assembly and rewrites it for a different platform or to provide extra functionality – features that the developer wants to have but didn’t want to code. With Volta, the developer simply declares their “intention” through a series of attributes and Volta re-writes the IL code to implement the requested feature! Volta has a post-compiler to perform this bit of magic and they target the IL specifically so that it is language agnostic so any .NET language can utilize this new toolkit. This is a primary difference from GWT, which targets only Java today.
The Volta team organizes this IL re-writing capability into three areas: repurposing, remodulating and refactoring.
Repurposing
Repurposing is the feature we have already mentioned – taking the IL and transforming it into something else such as JavaScript. With this capability we can repurpose the code for other platforms (such as the web) without doing a manual rewrite. This is the feature that has gotten the most attention so far because of the potential – the current target is basic JavaScript/HTML but the same technique could generate RIA clients using Silverlight.
Remodulating
Remodulating involves generating code that is directed at a specific browser at runtime so that we get the best possible experience we can for that user. This is probably the least interesting of the three types of rewriting as the web controls in ASP.NET have been able to do browser-dependent rendering since ASP.NET 1.0.
Comments