2008 - TechDays PT: Building Software + Services with Volta
-
Upload
daniel-fisher -
Category
Software
-
view
60 -
download
2
Transcript of 2008 - TechDays PT: Building Software + Services with Volta
ARC05Building Software + Services with VoltaDaniel [email protected] Architect | CTO devcoach®
Michael [email protected]
Software Architect | CTO devcoach®
www.devcoach.com Experts each with 10+ years experience
Development Architecture Consulting & Coaching
Community activists Annual Software Developer Community Event
Deep knowledge and skills on Service Orientation & Agile Methods Web & Data access Security & Deployment
Real Projects – Not just cool demos!
Agenda
ObjectivesDistributed Systems, today called S+S ;-)The Volta ApproachSummary
A DistributedSystem in Action
Yet another bookstore
Demo
What we‘ve seen
A distributed system consists of multiple services act in combination
Service is autonomous (black box)Autonomous services enable scalability
Just deploy your service to another box
A DistributedSystem in Development
Yet another bookstore – revisited
Demo
What we‘ve seen
Autonomy introduces complexity
Distributed Computing – Challenges
AutonomyPlumbingDeployment
Distributed Computing - Approaches
Hide ComplexityModeling
Code Generation
Code Partioning Code Recompilation
What is Volta
It is a toolset that allows you to build distributed applications much easier
It‘s NOT a product (yet)!
Microsoft want‘s your feedback!
How does Volta make it easier?
Use familiar technologies and LanguagesDesign and Build „like just for one Client“Decide declarativly where your code will live
What Volta will give you
It will take your existing .NET code base and fulfills it with
JavaScript for X-BrowserWeb Services for the back endPlumbing for communication
VOLTAWelcome to the world of
Under the hood…
Rewriting of existing MSIL code and recompilation
Re-factoring converts single-tier code into distributed code.Re-targeting converts MSIL code into code for other (virtual) machines. Re-modulating tailors a single piece of code for x-browsers.
Re-factoring in detail
Volta applies transformations on compiled code based on custom attributes
During development code runs on the client. Redistribution is merely a matter of rebuilding. Automatically creates the marshalling and security code necessary to execute the code on multiple tiers.
Volta Re-facoring Illustrated
CLRBrowse
rApplication Code
CLR
Browser
Client Script
Server Code
JSE
Program.cs
using System;using Microsoft.LiveLabs.Volta.Html; namespace VoltaApplication1{ class Program { static void Main(string[] args) { Browser.Load(new VoltaPage1()); } }}
Page.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>VoltaApplication1</title> <link rel="shortcut icon" href="/favicon.ico"/> <style type="text/css"> </style></head><body> <p>Your name:</p> <p><input id="Text1" type="text" /></p> <p><button id="Button1">Greet</button></p> <div id="Greeting"></div></body></html>
VoltaPage1.cs
using Microsoft.LiveLabs.Volta;using Microsoft.LiveLabs.Volta.Html;
namespace VoltaApplication1{ public partial class VoltaPage1 : Page { private Input nameElement; private Div greetingElement; private Button button1; partial void InitializeComponent() { nameElement = Document.GetById<Input>("Text1"); greetingElement = Document.GetById<Div>("Greeting"); button1 = Document.GetById<Button>("Button1"); } }}
Greeter
namespace VoltaApplication1{ public class Greeter { string helloStr;
public Greeter() { helloStr = "Hello"; }
public string Greet(string name) { return helloStr + " " + name; } }}
VoltaPage1.cs Continued
…namespace VoltaApplication1{ public partial class VoltaPage1 : Page { … public VoltaPage1() { InitializeComponent(); var greeter = new Greeter();
button1.Click += delegate { var name = nameElement.Value; greetingElement.InnerText = greeter.Greet(name); }; } }}
Where are we
Visual Studio Integration ;-)VS 2008 with .NET 3.5
Write it in C#Execute it as JavaScript
Write cloud apps with your favorite .NET language using the complete toolchain
Intellisense, Snippets, FxCop …
Libraries: HTML
The HTML library provides programmatic access to the HTML DOM.
Query their contents such as the text typed in an input field
Respond to events such as fire off a method when a button is clicked
Update themsuch as a status message
Libraries: XML
The Volta XML library implements a subset of the classes provided by the .NET MSXML2 3.0.
We use this library to work with XMLLoad and save documentsCreate and access document nodesImplement the XmlHttpRequest Call
Ajax design pattern..
Object Sharing
Typed access:Properties onlyNO fields
Untyped accessBy index Hashtable
Object Sharing
{"weatherObservation":{"stationName":"Redmond, Roberts Field Airport","datetime":"2007-08-27 13:56:00"}}
public class WeatherObservation{ [Import] public extern string datetime{get;} [Import] public extern string stationName{get;}}
public class WeatherService { [Import] public extern WeatherObservation weatherObservation{get; }}
Volta calls JavaScript
namespace Microsoft.LiveLabs.Volta.VirtualEarth{ [Import( ScriptMemberNameCasing = Casing.Pascal, PassInstanceAsArgument = false)] public class Map { private static int s_counter; [Import("onLoadMap",PassInstanceAsArgument = true)] public extern event HtmlEventHandler MapLoaded; }}
Volta calls JavaScript
The compiler automatically generates the corresponding .NET element.
If another name is needed: use the Import custom attribute.
Volta passes an sender object as the first argument
override this default in the Import arguments.
The Volta.JavaScript namespace declares .NET functions and properties for standard JavaScript globals, like Global.Eval.
JavaScript calls Volta
[Export]public static double ComputeVelocity(){ // computation goes here}
Only static methods Compiler generates corresponding method through camel casing the name of the C# element.
The Volta compiler doesn't guarantee that the uniqueness of the generated name.
No namespaces in JavaScript
Greeter Distributed
namespace VoltaApplication1{ [RunAtOrigin()] public class Greeter { ... }}
Greeter Distributed Cont.
namespace VoltaApplication1{ [RunAtOrigin()] public class Greeter { ... [Async] public extern void Greet( string name, Callback<string> callback);
}}
VoltaPage1.cs Continued
…namespace VoltaApplication1{ public partial class VoltaPage1 : Page { … public VoltaPage1() { … button1.Click += delegate { var name = nameElement.Value; greeter.Greet( name, message => { greetingElement.InnerText = "async: " + message; });
};…
A DistributedSystem with Volta
Yet another bookstore
Demo
What we’ve seen
Volta tier splitting automates the creation of the communication plumbing code, serialization, and remoting. Simply mark classes or methods with a custom attribute that tells the Volta compiler where they should run.
Unmarked classes and methods continue to run on the client.
But have noticed this?Volta applications run virtually anywhere, even where an CLR is not available.
Web application can run in most standards-compliant browsers.Other applications can be targeted to take advantage of the CLR.
A change in the .NET world?
Volta extends the reach of the .NET platform to cover the cloud. The only differences at the source-code level are the presence and positions of custom attributes.
It DOES NOT 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.
Summary
Volta enables to prototype and refine designs through refactoring DURING developmentOffers the same programming model on the browser and the server.
A really cool approach on building distributed apps.
But you still have to architect your system ;-)
q&a
Thank you!
Outros RecursosPara Profissionais de TI
Beneficie de 40% de desconto.
Faça a sua Subscrição em
www.gettechnetplus.com e utilize o
promocode TLNW08
Software em versão completa para avaliação2 incidentes de suporte gratuito profissionalAcesso antecipado às versões betasoftware exclusivo: Capacity Planneractualizações de segurança e service packsformação gratuita ….e muito mais.
www.microsoft.com/portugal/technet/subscricoes
Outros RecursosPara Programadores
Software em versão completa para avaliaçãoSuporte técnico 24x7 para incidentesAcesso antecipado às versões betaMicrosoft OfficeSoftware Assuranceformação gratuita ….e muito mais.
www.microsoft.com/portugal/msdn/subscricoes
Outros RecursosCertificações
www.microsoft.com/learning
Até 30 Junho 08, beneficie de uma
segunda tentativa para fazer o seu
exame de certificação!
Questionário de Avaliação Passatempo!
Complete o questionário de avaliação e devolva-o no balcão da recepção…
…e habilite-se a ganhar 1 percurso de certificação por dia! Oferecido por:
…e habilite-se a ganhar 1 percurso de certificação MCTS por dia! Oferecido por:
…e habilite-se a ganhar 1 curso e exame por dia! Oferecido por:
Session Code Session Name
© 2008 Microsoft Corporation. Todos os direitos reservados.Esta apresentação destina-se apenas a fins informativos.A MICROSOFT NÃO FAZ GARANTIAS, EXPRESSAS OU IMPLÍCITAS NESTA APRESENTAÇÃO.