Using Dynamic Languages to Build Scriptable Apps

13
Using Dynamic Languages to Build Scriptable Apps Dino Viehland Senior Software Development Engineer Microsoft FT30

description

FT30. Using Dynamic Languages to Build Scriptable Apps. Dino Viehland Senior Software Development Engineer Microsoft. Why dynamic languages?. Simple enough for non-programmers Capable enough for programmers - PowerPoint PPT Presentation

Transcript of Using Dynamic Languages to Build Scriptable Apps

Page 1: Using Dynamic Languages to Build Scriptable Apps

Using Dynamic Languages to Build Scriptable Apps

Dino ViehlandSenior Software Development EngineerMicrosoft

FT30

Page 2: Using Dynamic Languages to Build Scriptable Apps

Why dynamic languages?> Simple enough for non-programmers> Capable enough for programmers

> “Python, like many good technologies, soon spreads virally throughout your development team and finds its way into all sorts of applications and tools…Python scripts are used in many areas of the game.”> Mustafa Thamer, Civilization IV development team

> Let users improve your application> Create an Application Ecosystem

> Users can share scripts, adding value to your apps

> Virtuous cycle> Enable Quick Fixes in the field

Page 3: Using Dynamic Languages to Build Scriptable Apps

Dynamic Languages…

Consumers

Page 4: Using Dynamic Languages to Build Scriptable Apps

Keeping it Simpledef fact(n): if n == 0: return 1 return n * fact(n-1)

print fact(13)

def fact(n)    return 1 if n == 0    n * fact(n-1)end

puts fact(13)

using System;

public class MathClass { public static int Factorial(int n) { if (n == 0) { return 1; } return n * Factorial(n – 1); } public static void Main(string[] args) { Console.WriteLine(Factorial(13)); }}

Page 5: Using Dynamic Languages to Build Scriptable Apps

Dynamic Language Runtime> Infrastructure for creating dynamic

languages> More languages available

> Shared interop protocol> Dynamic languages can talk to each

other> Static languages can talk to dynamic

languages> Lightweight hosting API

> One API, multiple languages> Users can choose the best language

Page 6: Using Dynamic Languages to Build Scriptable Apps

DLR Hosting

ScriptRuntime

ScriptScope ScriptEngine

ScriptSource

Page 7: Using Dynamic Languages to Build Scriptable Apps

Demo - Hosting> Getting Started> Getting Languages> Scopes

> Injecting our object model> Getting delegates back> Working with classes

> Using C# Dynamic> Getting More Dynamic

Page 8: Using Dynamic Languages to Build Scriptable Apps

Downloads…

> IronPython> http://ironpython.codeplex.com

> IronRuby> http://ironruby.net

> DLR> http://dlr.codeplex.com

> Source updated daily

Page 9: Using Dynamic Languages to Build Scriptable Apps

Summary> Scripting Languages can extend

your application> DLR provides common APIs for

multiple languages> DLR enables C# and VB.NET to

seamlessly access

Page 10: Using Dynamic Languages to Build Scriptable Apps

YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation

forms online atMicrosoftPDC.com

Page 11: Using Dynamic Languages to Build Scriptable Apps

Learn More On Channel 9> Expand your PDC experience through

Channel 9

> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses

channel9.msdn.com/learnBuilt by Developers for Developers….

Page 12: Using Dynamic Languages to Build Scriptable Apps

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Page 13: Using Dynamic Languages to Build Scriptable Apps