Microsoft Live Labs :: VOLTA

Microsoft Live Labs Volta helps developers who build distributed applications on the .NET platform, using the Microsoft development stack (programming languages, libraries, and Visual Studio). This version of Volta supports applications that run on the Microsoft CLR, a JavaScript-enabled browser, or a combination of the two.

First, this document introduces the Volta technology. Then, it covers two important Volta targets that developers are likely to build and deploy: applications and controls. Recipe-like descriptions for several common web-based scenarios follow. The document concludes with an overview of the libraries installed with Volta, and a summary of known issues and limitations.

The Volta Programming Model

In essence Volta is a recompiler. Volta works on MSIL rather than on a textual source language. Volta rewrites MSIL into any number of target languages, including, today JavaScript and MSIL itself. Rewriting, as a general technology, lets us delay permanent decisions about architecture, execution platform and browser until after our code is basically working. Furthermore, it frees us from having to express all these irreversible decisions in your source code. The result is a programming model that enables us to easily reshape a working application, and finally realizes the promise of one application running anywhere.

Volta effects recompilation through 3 general capabilities: refactoring, retargeting, and remodulating. Refactoring converts single-tier code into distributed, concurrent code as directed by user-supplied annotations. Retargeting converts MSIL code into code for other virtual machines. Remodulating tailors a single piece of code for multiple browsers. The next 3 sections explain in more detail.

Architecture Refactoring

The Volta programming model takes refactoring one step further. Volta applies transformations on our compiled code based on metadata, in particular, custom attributes prefixed on classes or methods that could run on a server tier. During development, all code runs in the client for ease of testing and debugging. Redistributing the code amongst client and server is merely a matter of moving custom attributes around and rebuilding. The Volta rewriter automatically creates and deploys the marshalling and security code necessary to execute the code on multiple tiers. The following diagram illustrates evolution of a Volta application from single-tier architecture to a distributed, multi-tiered architecture.


After refactoring, notice that the same application that used to run in one instance of the CLR is now running on two tiers. Volta dramatically extends the reach of the .NET platform to cover the cloud. We emphasize that the only differences at the source-code level are the presence and positions of custom attributes. Volta doesn’t eliminate the intellectual challenges of distributed computing. We must still formulate strategies for partitioning functionality and dealing with network latency and availability. Volta does, however, radically simplify the error-prone plumbing and re-plumbing of communication code.

Volta leverages the entire .NET platform, including most libraries and programming languages. We can write in our favorite .NET languages, use familiar .NET libraries and tools, and produce sophisticated distributed applications using only the “materials already in the room.” Without Volta we are exposed to too many inconsistent, special-purpose languages with kludges to help them interact in the cloud. For instance, typical methodologies for cloud programming involve combinations of ASP, PHP, Flash, XML, HTML, CSS, JavaScript, Perl or Ruby, C# or Java, SQL, and even more! Volta reduces the brittleness of distributed applications by lowering the sensitivity to idiosyncrasies of multiple languages and dialects.

Another important advantage of architecture refactoring is opening up brown-field scenarios. With minimal changes we can run existing .NET code in the cloud, greatly increasing the user base of code that may have been designed only for a single tier. Volta gives us a new dimension of software reuse. Traditionally, we would endeavor to reuse bits and pieces of source code in new scenarios. Volta lets us reuse binaries in new scenarios.

In summary, Volta confers flexibility in the architecture dimension through:

  • Language-independence. Write Volta code in any language that compiles into MSIL. For example, C#, VB, IronPython, etc.
  • Leverage the entire .NET toolchain. Use libraries; the IDE, Intellisense, auto-complete, snippets; FxCop; profiler; class browser; ILDASM; and so on.
  • Low entry barrier. Reduce your learning burden; use “only the languages in the room.”
  • Brown-field applicability. Volta-enable existing applications for the cloud.
  • Beyond 2 tiers. Refactor to as many tiers as you need using exactly the same mechanisms recursively applied.

Platform Retargeting: Extend the Reach

Without Volta, we must choose not only the architecture, but also the execution environment before we write code. For example, we often start with a WinForms application, confining us to client-side architecture and CLR execution.

We’ve already seen that Volta tier splitting lets us refactor the application so that part of it runs on the server. Volta retargeting lets us run MSIL code also in a JavaScript engine. Primary scenarios involve JavaScript in a browser running the client side of a distributed application. However Volta is not tethered to the browser and retargeted code runs in any JavaScript engine, such as the Jscript engine bundled with Internet Explorer.

Volta retargeting employs the technique of deep embedding, which preserves precise semantics of CLR objects, classes, methods, events, and so on, despite some rather deep impedance mismatches between the two platforms. For instance, MSIL is statically typed, whereas JavaScript is dynamically typed. Volta does all the hard work for us, though, and we are not restricted to a subset of .NET language features. Anything MSIL can do, including events, exceptions, casts, and generics, runs precisely correctly on alternative platforms. Volta’s semantic fidelity is orthogonal to tier-splitting, so, with some limitations, it’s possible to fire events and exceptions across tiers, as if they were on the same runtime instance.

Let your imagination be your guide. Retargeting is independent of refactoring and we can mix and match them as appropriate to our scenarios.

Let’s develop a simple scenario. Consider a typical web application, and focus attention on the component running in the browser. Without Volta, we write HTML, CSS, and JavaScript, targeting the browser’s execution environment, in addition to server code. With Volta, we have one programming model for both tiers, namely .NET. Volta retargets the browser component, writing the JavaScript for us from MSIL, hiding the impedance mismatch.

Retargeting is all the more important in the face of Ajax, which encourages ever more functionality in the browser for increased responsiveness and better user experiences.

In summary, Volta confers flexibility in the execution-platform dimension through:

  • Deep embedding of CLR semantics. Preserve exact CLR semantics across platforms.
  • Cross-browser support. Use one programming model across browsers.
  • Complete orthogonality with refactoring. Mix and match refactoring and retargeting.
  • Ajax-ready. Write Ajax patterns and idioms in familiar .NET languages.

Browser Remodulating: Cross-Browser Support

Despite the standardization of DHTML, which includes JavaScript and DOM access, many subtle differences exist amongst popular browsers. The rise of Ajax has amplified the differences, and furthermore, has created a sense of urgency in the marketplace, hence a continuous flow of new features and capabilities that developers must chase. Consequently, without Volta, developers must write more and more browser-specific code, leaving them less time to focus on their applications.

Volta hides as many browser-specific differences as possible, but still allows developers to leverage the unique capabilities of particular browsers. Instead of targeting solely the intersection of browser capabilities, Volta targets the entire union, but makes the intersection browser-agnostic. This is browser remodulating. From the developer’s point of view Volta attenuates browser differences. But what about testing and debugging? Volta and the Visual-Studio integration supports debugging and testing of applications with full transparency. Visual Studio’s Solution Platform dropdown lets us choose the specific browser we want for a testing/debugging session. This allows us to see how each browser renders the HTML.

In this release Volta supports the Internet Explorer and Firefox browsers. We accommodate specific browsers through a combination of changes to the recompiler and libraries, plus Visual Studio integration for debugging.

In summary, Volta confers flexibility in the execution-platform dimension through:

  • Cross-browser support. Write the same code for Internet Explorer and Firefox.
  • Debugging transparency. Debug code with a specific browser.
  • Leverage browser-specific features. Where needed, access features unique to each browser.
  • Visual-Studio integration. Enjoy seamless integration with the IDE.

One thought on “Microsoft Live Labs :: VOLTA

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s