X
Business

Microsoft creates GWT clone

While the GWT conference was going on in San Francisco, Microsoft announced its own take on the concept: Volta. GWT compiles Java source code into Javascript, and now Volta does the same thing for C# and other .NET languages. A technology preview is available now, but it has a few rough edges.
Written by Ed Burnette, Contributor
Microsoft creates GWT clone
While the GWT conference was going on in San Francisco, Microsoft announced its own take on the concept: Volta. GWT compiles Java source code into Javascript, and now Volta does the same thing for C# and other .NET languages. "JavaScript is just an assembly language," says Live Labs product manager Alex Daley.

Erik Meijer goes into more detail in an OOPSLA paper called "Democratizing The Cloud" (pdf):

We pick the .NET Common Language Runtime (CLR) as our universal computation model. We prefer, of course, to use the already available CLR implementation on each respective tier: SQLCLR on the data-tier; regular CLR on the middle-tier; and Silverlight for Web-clients, or the regular CLR for desktop clients.

When no CLR is on hand, we use the materials already available in the room. On the data-tier we compile MSIL to SQL. This is the approach currently taken by LINQ-to-SQL and LINQ-to-Entities. On the client-tier we compile MSIL to JavaScript or Flash. This is the approach taken by Volta. The upshot is that we uniformly provide (the illusion of) the .NET platform on each tier, in effect stretching it to cover the Cloud. Application programmers only need to care that they can run MSIL everywhere, not about how this is technically accomplished under the hood.

Getting Started To use Volta, you first need to install Visual Studio 2008. Create a new Volta project using the wizards provided, design a regular-looking HTML web page, define your business logic in C#, and then add some boilerplate code that associates your web components (such as an Input box) with C# variables. If you publish the project at this point, all the object code produced by the C# compiler (MSIL) will be converted into Javascript resulting in a client-only application that runs in the browser. Like GWT, Volta provides a subset of the standard class library for code running on the client.

To split the program between client and server tiers, you flip a switch and add the "[RunAtOrigin()]" annotation in the source code to indicate which classes that you want to run on the server. Then just rebuild and poof, all the RPC/Web service stuff is taken care of for you. This is one area where Volta differentiates itself from GWT. In GWT, the client/server split is explicitly written into the code by the programmer. Another difference is that remote calls in Volta are synchronous by default but GWT's remote calls are asynchronous by default. Asynchronous calls require a little extra code to implement but result in a better experience for the user.

By setting another option you can have your Volta application cut trace records for later analysis in the WCF Service Trace Viewer Tool. This tool gives you an easy way to view, group, and filter traces so you can diagnose and repair issues in a multi-tier environment.

Word Worm sample

Microsoft labels Volta as "experimental" at this point so there are a few rough edges. For example, every class used in your application will be a separate download from the server. This means currently you can expect Volta apps to be much slower than GWT apps, at least the first time you run them. When I tried the online WordWorm sample, Firefox 2 put up a dialog saying the script was unresponsive (see above). On Internet Explorer it worked but took over a minute to start up. According to Microsoft they plan to make this smarter in future versions.

Analysis If Volta had been released two years ago it would have been revolutionary. At this point, though, Microsoft is playing catch-up with Google and Adobe. Volta also sends a confusing message to .NET developers targeting the browser. Silverlight 1.1 is supposed to include a full .NET environment inside the browser for multiple platforms. Now with Volta you can get "the illusion of" the same thing without a plug-in. So why do you need Silverlight?

Another concern developers will have is Microsoft's commitment to browsers other than Internet Explorer. If, for example, a new browser or operating system came out that broke GWT, then the source code is available so you could fix it yourself if Google's GWT team wasn't fast enough. That's not an option with Volta.

The Volta technology preview is available for download now at Microsoft Live Labs. The current version supports Internet Explorer and Firefox only.

Editorial standards