Presentation is loading. Please wait.

Presentation is loading. Please wait.

IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC + + =

Similar presentations


Presentation on theme: "IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC + + ="— Presentation transcript:

1 IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC foyc@coryfoy.comfoyc@coryfoy.com - @cory_foy + + =

2 Hello, IronRuby!

3 Ruby

4 IronRuby

5 Ruby and WinForms

6 Ruby and Silverlight

7 History Ruby and.NET Ruby to.NET Ruby CLR Project RubyCLR All attempted to run Ruby on top of the CLR

8 History CLR 2.0 (.NET 3.0 and 3.5 were still CLR 2.0) No dynamic dispatch Everything had to be compiled Lots of magic, and shims CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/37341680@N04/4278580062

9 History alias alias_method_missing method_missing def method_missing(name, *params) alias_method_missing(name, *params) unless name == :Count create_ruby_instance_method(self.class, 'Count') do include 'System.Collections' ldarg_2 call 'static Marshal::ToClrObject(VALUE)' call 'ArrayList::get_Count()' call 'static Marshal::ToRubyNumber(Int32)' ret end self.Count end

10 History CLR 4.0 Dynamic keyword (C#) Calculator calc = GetCalculator(); int sum = calc.Add(1, 3); var calc = GetCalculator(); int sum = calc.Add(1, 3); object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 }); int sum = Convert.ToInt32(res); dynamic calc = GetCalculator(); int sum = calc.Add(1, 3);

11 History Dynamic Keyword Calculator calc = GetCalculator(); int sum = calc.Add(1, 3);

12 History Dynamic Keyword var calc = GetCalculator(); int sum = calc.Add(1, 3);

13 History Dynamic Keyword object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 }); int sum = Convert.ToInt32(res);

14 History Dynamic Keyword dynamic calc = GetCalculator(); int sum = calc.Add(1, 3);

15 History DLR Introduced in 2007 Set of libraries to assist language developers Still runs on the CLI, and can access the CLR Standardizes the implementation of dynamic languages on the CLI/CLR

16 History IronRuby John Lam hired by Microsoft in 2006 Announced in 2007 at MIX7 Goal to make Ruby a first-class citizen Completely rewritten to take advantage of the DLR

17 History DLR Dynamic Language Runtime (DLR) Common Language Runtime (CLR) Common Hosting Model Runtime Language Implementation

18 History Ruby Common Language Runtime Dynamic Language Runtime C# VB

19 WHY RUBY?

20 RUBY IS Love! CREDIT: http://www.flickr.com/photos/wwwor ks/3800306463 http://www.flickr.com/photos/wwwor ks/3800306463 CREDIT: http://www.flickr.com/photos/19684 903@N00/317182464 http://www.flickr.com/photos/19684 903@N00/317182464 CREDIT: http://www.flickr.com/photos/expressm onorail/2631659122 http://www.flickr.com/photos/expressm onorail/2631659122 CREDIT: http://www.flickr.com/photos/stuckincu stoms/2366980580 http://www.flickr.com/photos/stuckincu stoms/2366980580

21 CREDIT: http://www.flickr.com/photos/billburris/2822607830http://www.flickr.com/photos/billburris/2822607830

22 TYPE SAFETY STATIC CODE ANALYSIS COMPILER CATCHES ERRORS INTELLISENSE OBJECT GRAPHS DEBUGGING CODE SAFETY SEALED TYPES

23 TEST ALL THE FRICKIN’ TIME

24 CREDIT: http://www.flickr.com/photos/fatboyke/2668411239http://www.flickr.com/photos/fatboyke/2668411239

25 Metaprogramming All Classes Are Open Definitions are active All method calls have a receiver Classes are objects CREDIT: HTTP://WWW.FLICKR.COM/PHO TOS/CHOCONANCY/2470073711

26 Duck Typing

27 Open Classes CREDIT: HTTP://COMMONS.WIKIMEDIA.ORG/WIKI/FILE:N EON_OPEN_SIGN.JPG

28 Monkey Patching

29 Dynamism CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/LABG UEST/3510995344/

30 method_missing CREDIT: HTTP://WWW.FLICKR.COM/PHO TOS/TAITOH/3029653729/

31 RubyGems Standardized Packaging System Central Repository for hosting packages Allows for installation and management of multiple installed versions

32 RubyGems THAT’S IT!

33 IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer ??? Profit!!!

34 IronRuby Basics..and what did we just install? bin - IronRuby executables (ir.exe, etc) lib - Helpers for including assemblies and other common tasks samples - Contains the Tutorial app and others silverlight - Contains the Silverlight Dynamic Languages SDK

35 IronRuby Basics..and, how the heck did it just do that? Common Language Runtime (CLR) Dynamic Language Runtime (DLR) Common Hosting Model Runtime Language Implementation ASTs Language Context CompilerRuntime Call sites Binders Rules Common Hosting Model ScriptRuntimeScriptEngine ScriptScopeScriptSource

36 Integration Calling.NET from IronRuby Calling IronRuby from.NET WinForms / WPF / Silverlight Cucumber / RSpec

37 Get Involved! Website - http://ironruby.net http://ironruby.codeplex.comhttp://ironruby.codeplex.com/ http://github.com/ironruby Mailing List - http://rubyforge.org/mailman/listinfo/ironruby-core foyc@coryfoy.comfoyc@coryfoy.com | @cory_foy Slides @ http://blog.coryfoy.comhttp://blog.coryfoy.com

38

39


Download ppt "IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC + + ="

Similar presentations


Ads by Google