2008 - TechDays PT: Building Software + Services with Volta

44
ARC05 Building Software + Services with Volta Daniel Fisher [email protected] e Software Architect | CTO devcoach® Michael Willers [email protected] e Software Architect | CTO devcoach®

Transcript of 2008 - TechDays PT: Building Software + Services with Volta

Page 1: 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®

Page 2: 2008 - TechDays PT: Building Software + Services with Volta

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!

Page 3: 2008 - TechDays PT: Building Software + Services with Volta

Agenda

ObjectivesDistributed Systems, today called S+S ;-)The Volta ApproachSummary

Page 4: 2008 - TechDays PT: Building Software + Services with Volta

A DistributedSystem in Action

Yet another bookstore

Demo

Page 5: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 6: 2008 - TechDays PT: Building Software + Services with Volta

A DistributedSystem in Development

Yet another bookstore – revisited

Demo

Page 7: 2008 - TechDays PT: Building Software + Services with Volta

What we‘ve seen

Autonomy introduces complexity

Page 8: 2008 - TechDays PT: Building Software + Services with Volta

Distributed Computing – Challenges

AutonomyPlumbingDeployment

Page 9: 2008 - TechDays PT: Building Software + Services with Volta

Distributed Computing - Approaches

Hide ComplexityModeling

Code Generation

Code Partioning Code Recompilation

Page 10: 2008 - TechDays PT: Building Software + Services with Volta

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!

Page 11: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 12: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 13: 2008 - TechDays PT: Building Software + Services with Volta

VOLTAWelcome to the world of

Page 14: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 15: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 16: 2008 - TechDays PT: Building Software + Services with Volta

Volta Re-facoring Illustrated

CLRBrowse

rApplication Code

CLR

Browser

Client Script

Server Code

JSE

Page 17: 2008 - TechDays PT: Building Software + Services with Volta

Program.cs

using System;using Microsoft.LiveLabs.Volta.Html; namespace VoltaApplication1{ class Program { static void Main(string[] args) { Browser.Load(new VoltaPage1()); } }}

Page 18: 2008 - TechDays PT: Building Software + Services with Volta

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>

Page 19: 2008 - TechDays PT: Building Software + Services with Volta

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"); } }}

Page 20: 2008 - TechDays PT: Building Software + Services with Volta

Greeter

namespace VoltaApplication1{ public class Greeter { string helloStr;

public Greeter() { helloStr = "Hello"; }

public string Greet(string name) { return helloStr + " " + name; } }}

Page 21: 2008 - TechDays PT: Building Software + Services with Volta

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); }; } }}

Page 22: 2008 - TechDays PT: Building Software + Services with Volta

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 …

Page 23: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 24: 2008 - TechDays PT: Building Software + Services with Volta

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..

Page 25: 2008 - TechDays PT: Building Software + Services with Volta

Object Sharing

Typed access:Properties onlyNO fields

Untyped accessBy index Hashtable

Page 26: 2008 - TechDays PT: Building Software + Services with Volta

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; }}

Page 27: 2008 - TechDays PT: Building Software + Services with Volta

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; }}

Page 28: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 29: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 30: 2008 - TechDays PT: Building Software + Services with Volta

Greeter Distributed

namespace VoltaApplication1{ [RunAtOrigin()] public class Greeter { ... }}

Page 31: 2008 - TechDays PT: Building Software + Services with Volta

Greeter Distributed Cont.

namespace VoltaApplication1{ [RunAtOrigin()] public class Greeter { ... [Async] public extern void Greet( string name, Callback<string> callback);

}}

Page 32: 2008 - TechDays PT: Building Software + Services with Volta

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; });

};…

Page 33: 2008 - TechDays PT: Building Software + Services with Volta

A DistributedSystem with Volta

Yet another bookstore

Demo

Page 34: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 35: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 36: 2008 - TechDays PT: Building Software + Services with Volta

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.

Page 37: 2008 - TechDays PT: Building Software + Services with Volta

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 ;-)

Page 38: 2008 - TechDays PT: Building Software + Services with Volta

q&a

Page 39: 2008 - TechDays PT: Building Software + Services with Volta

Thank you!

Page 40: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 41: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 42: 2008 - TechDays PT: Building Software + Services with Volta

Outros RecursosCertificações

www.microsoft.com/learning

Até 30 Junho 08, beneficie de uma

segunda tentativa para fazer o seu

exame de certificação!

Page 43: 2008 - TechDays PT: Building Software + Services with Volta

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

Page 44: 2008 - TechDays PT: Building Software + Services with Volta

© 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.