On 5th December, Microsoft Live Labs announced Volta. The idea of Volta is to be able to write your application in a .NET language of your choice and then the Volta infrastructure takes care of targetting the right platform (JavaScript or SilverLight, IE or FireFox). This side of things is pretty neat. The other thing it allows you to do is to write your application monolithically and then decide on distribution later on based on profiling, etc. This sounds quite neat but I have some reservations.
I went through the DCOM wave or "COM with a longer wire" as it was labelled at the time and learned some hard lessons. I then went through the .NET Remoting experience and learned ... well ... the same hard lessons. The reality is unless you design something to be remote then when you remote it its going to suck.
Lets look at a Volta example. First some basics:
- Download and install the CTP
- Create a Volta application project
Now lets build our Volta application. You create the HTML page for the UI (heres the important snippet)
<
body>
<p>Press the button to do chatty stuff</p>
<p><button id="chat">Chat!</button></p>
<div id="output" />
</body>
You create the Volta code to wire up your code to the HTML
public partial class VoltaPage1 : Page
{
Button chat;
Div output;
public VoltaPage1()
{
InitializeComponent();
}
partial void InitializeComponent()
{
chat = Document.GetById<Button>("chat");
output = Document.GetById<Div>("output");
}
}
Now create a class that has a chatty interface
class HoldStatement
{
public string The { get { return "The "; } }
public string Quick { get { return "Quick "; } }
public string Brown { get { return "Brown "; } }
public string Fox { get { return "Fox "; } }
public string Jumped { get { return "Jumped "; } }
public string Over { get { return "Over "; } }
public string Lazy { get { return "Lazy "; } }
public string Dog { get { return "Dog!"; } }
}
OK now lets wire up the event handler on the button to output a statement in the output div
partial void InitializeComponent()
{
chat = Document.GetById<Button>("chat");
output = Document.GetById<Div>("output");
HoldStatement hs = new HoldStatement();
chat.Click += delegate
{
output.InnerText = hs.The + hs.Quick + hs.Brown + hs.Fox + hs.Jumped +
hs.Over + hs.The + hs.Lazy + hs.Dog;
};
}
If we compile this in Release mode and press F5 we get a browser and a server appears in the system tray.
If you double click on this server icon you get a monitor window that allows you to trace interaction with the server. Bring that up and check the Log Requests checkbox.

Now click on the Chat! button in the browser. Notice you get a bunch of assembly loads in the log window. Clear the log and press the Chat! button again. Now you see there are no requests going across the wire as the entire application is running in the browser.
Now go to the project properties and select the Volta tab. Enable the <queue dramatic music> Tiersplitter. Go to the HoldStatement class, right click on it and select Refactor -> Tier Split to Run at Origin. Notice we now get a [RunAtOrigin] attribute on the class.
Rebuild and press F5 again. Bring up the Log window again and select to log messages. Now every time you press the Chat! button it makes a request to the server. We have distributed our application with just one attribute! - how cool is that?! But hold on ... how many requests are going to the server? Well one for each property access.

Latency is the death knell of many distributed applications. You have to design remote services to be chunky (lots of data in one round trip) otherwise the network roundtripping will kill your application performance. So saying you can defer architecting your solution in terms of distribution then simply annotate classes with an attribute is a dangerous route to go down. We have already learned the hard way that taking a component and just putting it on the other end of a wire does not make for a good distributed application - Volta appears to be pushing us in that direction again.