IronRuby for the .NET Developer

2,527 views
2,438 views

Published on

This was my presentation from the MIX10 conference in Las Vegas introducing Ruby and IronRuby to .NET Developers. Covers intergration with CLR, BCL and Silverlight

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,527
On SlideShare
0
From Embeds
0
Number of Embeds
127
Actions
Shares
0
Downloads
36
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

  • Sample Ruby App, Extend Access to .NET Object, Extend to pop up a WinForms MessageBox, Extend to do a 3D WPF “Hello MIX10!”




  • Ruby to .NET - Thomas Sondergaard - 2003
    Ruby CLR Project - Funded by Microsoft / Queensland Univ of Tech
    RubyCLR - John Lam’s first attempt
  • Yep, it’s all about the magic. What kind of magic?
  • Yep, it’s all about the magic. What kind of magic?
  • This kind of magic




























  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • So, Why Ruby? What’s so great about Ruby?
  • But I hear many of you are quite skeptical.
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • But I’m going to sidestep all of these with one statement
  • Performance Implications next
  • Nor am I going to dive into performance implications. Compiled code is going to be faster. But I am going to talk about something very cool in Ruby







  • This allows us to build DSLs. If we think about what we use on a daily basis, it equates to lots of DSLs - MSBuild scripts, proj files, SQL Queries.



  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.
  • Discuss installing, and the layout of the project, then show a simple IronRuby form and talk about how the request was processed through the system.









  • IronRuby for the .NET Developer

    1. 1. + + = IronRuby for the .NET Developer Cory Foy - Cory Foy, LLC foyc@coryfoy.com - @cory_foy
    2. 2. Hello, IronRuby!
    3. 3. History Ruby and .NET Ruby to .NET Ruby CLR Project RubyCLR All attempted to run Ruby on top of the CLR
    4. 4. 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
    5. 5. 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
    6. 6. 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
    7. 7. History CLR 4.0 Dynamic keyword (C#)
    8. 8. History CLR 4.0 Dynamic keyword (C#) Calculator calc = GetCalculator(); int sum = calc.Add(1, 3);
    9. 9. History CLR 4.0 Dynamic keyword (C#) var calc = GetCalculator(); int sum = calc.Add(1, 3);
    10. 10. History CLR 4.0 Dynamic keyword (C#) object calc = GetCalculator(); Type calcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 }); int sum = Convert.ToInt32(res);
    11. 11. History CLR 4.0 Dynamic keyword (C#) dynamic calc = GetCalculator(); int sum = calc.Add(1, 3);
    12. 12. 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
    13. 13. 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
    14. 14. History DLR Dynamic Language Runtime (DLR) Common Language Runtime (CLR)
    15. 15. History DLR Dynamic Language Runtime (DLR) Common Hosting Model Common Language Runtime (CLR)
    16. 16. History DLR Dynamic Language Runtime (DLR) Common Runtime Hosting Model Common Language Runtime (CLR)
    17. 17. History DLR Dynamic Language Runtime (DLR) Common Language Runtime Hosting Model Implementation Common Language Runtime (CLR)
    18. 18. History Ruby Dynamic Language Runtime Common Language Runtime
    19. 19. History Ruby Dynamic Language Runtime Common Language Runtime
    20. 20. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    21. 21. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    22. 22. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    23. 23. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    24. 24. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    25. 25. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    26. 26. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
    27. 27. WHY RUBY?
    28. 28. RUBY IS LOVE!
    29. 29. CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/19684903@N00/317182464 CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/WWWORKS/3800306463 RUBY IS LOVE! CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/STUCKINCUSTOMS/2366980580 CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/EXPRESSMONORAIL/2631659122
    30. 30. CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/BILLBURRIS/2822607830
    31. 31. TYPE SAFETY CODE SAFETY OBJECT GRAPHS DEBUGGING STATIC CODE ANALYSIS SEALED TYPES INTELLISENSE COMPILER CATCHES ERRORS
    32. 32. TYPE SAFETY CODE SAFETY OBJECT GRAPHS DEBUGGING STATIC CODE ANALYSIS SEALED TYPES INTELLISENSE COMPILER CATCHES ERRORS
    33. 33. TEST ALL THE FRICKIN’ TIME
    34. 34. CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/FATBOYKE/2668411239
    35. 35. Metaprogramming CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/CHOCONANCY/2470073711 All Classes Are Open Definitions are active All method calls have a receiver Classes are objects
    36. 36. WHAT IS THIS? AND WHY IS IT HERE?
    37. 37. WHAT IS THIS? AND WHY IS IT HERE?
    38. 38. WHAT IS THIS? AND WHY IS IT HERE?
    39. 39. WHAT IS THIS? AND WHY IS IT HERE?
    40. 40. Duck Typing
    41. 41. Open Classes CREDIT: HTTP://COMMONS.WIKIMEDIA.ORG/WIKI/ FILE:NEON_OPEN_SIGN.JPG
    42. 42. Monkey Patching
    43. 43. method_missing CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/TAITOH/3029653729/
    44. 44. Dynamism CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/ LABGUEST/3510995344/
    45. 45. RubyGems Standardized Packaging System Central Repository for hosting packages Allows for installation and management of multiple installed versions
    46. 46. RubyGems
    47. 47. RubyGems THAT’S IT!
    48. 48. IronRuby Basics
    49. 49. IronRuby Basics Installing
    50. 50. IronRuby Basics Installing http://ironruby.net/Download
    51. 51. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer
    52. 52. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer ???
    53. 53. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer ??? Profit!!!
    54. 54. IronRuby Basics
    55. 55. IronRuby Basics ..and what did we just install?
    56. 56. IronRuby Basics ..and what did we just install? bin - IronRuby executables (ir.exe, etc)
    57. 57. IronRuby Basics ..and what did we just install? bin - IronRuby executables (ir.exe, etc) lib - Helpers for including assemblies and other common tasks
    58. 58. 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
    59. 59. 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
    60. 60. IronRuby Basics ..and, how the heck did it just do that? Dynamic Language Runtime (DLR) Common Language Runtime Hosting Model Implementation Common Language Runtime (CLR)
    61. 61. IronRuby Basics ..and, how the heck did it just do that? Runtime Call sites Binders Rules Common Language Runtime (CLR)
    62. 62. IronRuby Basics ..and, how the heck did it just do that? Language Implementation Language ASTs Compiler Context Common Language Runtime (CLR)
    63. 63. IronRuby Basics ..and, how the heck did it just do that? Common Hosting Model ScriptRuntime ScriptEngine ScriptScope ScriptSource Common Language Runtime (CLR)
    64. 64. Integration Calling .NET from IronRuby Calling IronRuby from .NET WinForms / WPF / Silverlight Cucumber / RSpec
    65. 65. Get Involved! Website - http://ironruby.net http://ironruby.codeplex.com/ http://github.com/ironruby Mailing List - http://rubyforge.org/mailman/listinfo/ ironruby-core foyc@coryfoy.com | @cory_foy Slides @ http://blog.coryfoy.com

    ×