SlideShare une entreprise Scribd logo
1  sur  69
+                   +

   =

        IronRuby for the
         .NET Developer
Cory Foy - Cory Foy, LLC
foyc@coryfoy.com - @cory_foy
Hello, IronRuby!
History

Ruby and .NET

  Ruby to .NET

  Ruby CLR Project

  RubyCLR

All attempted to run Ruby on top of the CLR
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
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
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
History
 CLR 4.0

  Dynamic keyword (C#)
History
 CLR 4.0

  Dynamic keyword (C#)

Calculator calc = GetCalculator();
int sum = calc.Add(1, 3);
History
 CLR 4.0

  Dynamic keyword (C#)

var calc = GetCalculator();
int sum = calc.Add(1, 3);
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);
History
 CLR 4.0

  Dynamic keyword (C#)

dynamic calc = GetCalculator();
int sum = calc.Add(1, 3);
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
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
History
 DLR

       Dynamic Language Runtime (DLR)




       Common Language Runtime (CLR)
History
 DLR

          Dynamic Language Runtime (DLR)

   Common
 Hosting Model




         Common Language Runtime (CLR)
History
 DLR

          Dynamic Language Runtime (DLR)

   Common
                     Runtime
 Hosting Model




         Common Language Runtime (CLR)
History
 DLR

          Dynamic Language Runtime (DLR)

   Common                            Language
                     Runtime
 Hosting Model                     Implementation




         Common Language Runtime (CLR)
History

                                Ruby




              Dynamic Language Runtime




      Common Language Runtime
History

                                Ruby




              Dynamic Language Runtime




      Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
History

                                    Ruby


     VB
C#                Dynamic Language Runtime




          Common Language Runtime
WHY RUBY?
RUBY IS LOVE!
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
CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/BILLBURRIS/2822607830
TYPE SAFETY
                                    CODE SAFETY


                  OBJECT GRAPHS

    DEBUGGING
                        STATIC CODE ANALYSIS


                SEALED TYPES
INTELLISENSE
                             COMPILER CATCHES ERRORS
TYPE SAFETY
                                    CODE SAFETY


                  OBJECT GRAPHS

    DEBUGGING
                        STATIC CODE ANALYSIS


                SEALED TYPES
INTELLISENSE
                             COMPILER CATCHES ERRORS
TEST
ALL
THE
FRICKIN’
TIME
CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/FATBOYKE/2668411239
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
WHAT IS THIS?
AND WHY IS IT HERE?
WHAT IS THIS?
AND WHY IS IT HERE?
WHAT IS THIS?
AND WHY IS IT HERE?
WHAT IS THIS?
AND WHY IS IT HERE?
Duck Typing
Open Classes

               CREDIT: HTTP://COMMONS.WIKIMEDIA.ORG/WIKI/
                         FILE:NEON_OPEN_SIGN.JPG
Monkey Patching
method_missing

                 CREDIT: HTTP://WWW.FLICKR.COM/
                   PHOTOS/TAITOH/3029653729/
Dynamism
           CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/
                    LABGUEST/3510995344/
RubyGems

Standardized Packaging System

Central Repository for hosting packages

Allows for installation and management of
multiple installed versions
RubyGems
RubyGems


    THAT’S IT!
IronRuby Basics
IronRuby Basics

Installing
IronRuby Basics

Installing

  http://ironruby.net/Download
IronRuby Basics

Installing

  http://ironruby.net/Download

  Download Windows Installer
IronRuby Basics

Installing

  http://ironruby.net/Download

  Download Windows Installer

  ???
IronRuby Basics

Installing

  http://ironruby.net/Download

  Download Windows Installer

  ???

  Profit!!!
IronRuby Basics
IronRuby Basics
..and what did we just install?
IronRuby Basics
..and what did we just install?

  bin - IronRuby executables (ir.exe, etc)
IronRuby Basics
..and what did we just install?

  bin - IronRuby executables (ir.exe, etc)

  lib - Helpers for including assemblies and other
  common tasks
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
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
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)
IronRuby Basics
..and, how the heck did it just do that?

                       Runtime

     Call sites        Binders             Rules




            Common Language Runtime (CLR)
IronRuby Basics
..and, how the heck did it just do that?

                 Language Implementation

                        Language
       ASTs                                Compiler
                         Context




              Common Language Runtime (CLR)
IronRuby Basics
..and, how the heck did it just do that?

                Common Hosting Model

 ScriptRuntime ScriptEngine ScriptScope    ScriptSource




           Common Language Runtime (CLR)
Integration

Calling .NET from IronRuby

Calling IronRuby from .NET

WinForms / WPF / Silverlight

Cucumber / RSpec
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
IronRuby for the .NET Developer

Contenu connexe

Tendances

Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
Atul Shridhar
 

Tendances (18)

ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
Intro for RoR
Intro for RoRIntro for RoR
Intro for RoR
 
Ruby Presentation
Ruby Presentation Ruby Presentation
Ruby Presentation
 
Ruby Introduction
Ruby IntroductionRuby Introduction
Ruby Introduction
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)
 
Por que Rails?
Por que Rails? Por que Rails?
Por que Rails?
 
Extending Ruby using C++
Extending Ruby using C++Extending Ruby using C++
Extending Ruby using C++
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
Pharo Arm Status
Pharo Arm StatusPharo Arm Status
Pharo Arm Status
 
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
[LibreOffice Asia Conference 2019] CJK Issues on LibreOffice(based on Korean ...
 
Perl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code LinterPerl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code Linter
 
Jython
JythonJython
Jython
 
Semana Interop: Trabalhando com IronPython e com Ironruby
Semana Interop: Trabalhando com IronPython e com IronrubySemana Interop: Trabalhando com IronPython e com Ironruby
Semana Interop: Trabalhando com IronPython e com Ironruby
 
[LibreOffice Korea-Japan online Seminar] Introduce to LibreOffice & Korean Is...
[LibreOffice Korea-Japan online Seminar] Introduce to LibreOffice & Korean Is...[LibreOffice Korea-Japan online Seminar] Introduce to LibreOffice & Korean Is...
[LibreOffice Korea-Japan online Seminar] Introduce to LibreOffice & Korean Is...
 
Go for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupGo for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B Meetup
 
Kotlin from-scratch
Kotlin from-scratchKotlin from-scratch
Kotlin from-scratch
 
FOSDEM 2020 Presentation : Precise, cross-project code navigation at GitHub s...
FOSDEM 2020 Presentation : Precise, cross-project code navigation at GitHub s...FOSDEM 2020 Presentation : Precise, cross-project code navigation at GitHub s...
FOSDEM 2020 Presentation : Precise, cross-project code navigation at GitHub s...
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
 

Similaire à IronRuby for the .NET Developer

Ruby'izing iOS development
Ruby'izing iOS developmentRuby'izing iOS development
Ruby'izing iOS development
toamitkumar
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
Wen-Tien Chang
 
MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoa
Thilo Utke
 
An introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-rails
vinicorp
 
An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506
Vu Hung Nguyen
 

Similaire à IronRuby for the .NET Developer (20)

IronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET PlatformIronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET Platform
 
Ruby'izing iOS development
Ruby'izing iOS developmentRuby'izing iOS development
Ruby'izing iOS development
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Concurrency in ruby
Concurrency in rubyConcurrency in ruby
Concurrency in ruby
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Ruby on Rails 3 Day BC
Ruby on Rails 3 Day BCRuby on Rails 3 Day BC
Ruby on Rails 3 Day BC
 
MacRuby
MacRubyMacRuby
MacRuby
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Introduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function InterfaceIntroduction to Ruby Native Extensions and Foreign Function Interface
Introduction to Ruby Native Extensions and Foreign Function Interface
 
Ruby on Rails Penetration Testing
Ruby on Rails Penetration TestingRuby on Rails Penetration Testing
Ruby on Rails Penetration Testing
 
A rough guide to JavaScript Performance
A rough guide to JavaScript PerformanceA rough guide to JavaScript Performance
A rough guide to JavaScript Performance
 
MacRuby & HotCocoa
MacRuby & HotCocoaMacRuby & HotCocoa
MacRuby & HotCocoa
 
An introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-rails
 
An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506
 
RubyMotion Introduction
RubyMotion IntroductionRubyMotion Introduction
RubyMotion Introduction
 

Plus de Cory Foy

Plus de Cory Foy (20)

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
 
Code Katas
Code KatasCode Katas
Code Katas
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
 
Scaling Agility
Scaling AgilityScaling Agility
Scaling Agility
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
 
SQE Boston - When Code Cries
SQE Boston - When Code CriesSQE Boston - When Code Cries
SQE Boston - When Code Cries
 
GOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesGOTO Berlin - When Code Cries
GOTO Berlin - When Code Cries
 
Rails as a Pattern Language
Rails as a Pattern LanguageRails as a Pattern Language
Rails as a Pattern Language
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
 
Agile Demystified
Agile DemystifiedAgile Demystified
Agile Demystified
 
When Code Cries
When Code CriesWhen Code Cries
When Code Cries
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 

Dernier

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Dernier (20)

Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 

IronRuby for the .NET Developer

  • 1. + + = IronRuby for the .NET Developer Cory Foy - Cory Foy, LLC foyc@coryfoy.com - @cory_foy
  • 3. History Ruby and .NET Ruby to .NET Ruby CLR Project RubyCLR All attempted to run Ruby on top of the CLR
  • 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. 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. 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. History CLR 4.0 Dynamic keyword (C#)
  • 8. History CLR 4.0 Dynamic keyword (C#) Calculator calc = GetCalculator(); int sum = calc.Add(1, 3);
  • 9. History CLR 4.0 Dynamic keyword (C#) var calc = GetCalculator(); int sum = calc.Add(1, 3);
  • 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. History CLR 4.0 Dynamic keyword (C#) dynamic calc = GetCalculator(); int sum = calc.Add(1, 3);
  • 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. 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. History DLR Dynamic Language Runtime (DLR) Common Language Runtime (CLR)
  • 15. History DLR Dynamic Language Runtime (DLR) Common Hosting Model Common Language Runtime (CLR)
  • 16. History DLR Dynamic Language Runtime (DLR) Common Runtime Hosting Model Common Language Runtime (CLR)
  • 17. History DLR Dynamic Language Runtime (DLR) Common Language Runtime Hosting Model Implementation Common Language Runtime (CLR)
  • 18. History Ruby Dynamic Language Runtime Common Language Runtime
  • 19. History Ruby Dynamic Language Runtime Common Language Runtime
  • 20. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 21. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 22. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 23. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 24. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 25. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 26. History Ruby VB C# Dynamic Language Runtime Common Language Runtime
  • 27.
  • 30. 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
  • 32.
  • 33. TYPE SAFETY CODE SAFETY OBJECT GRAPHS DEBUGGING STATIC CODE ANALYSIS SEALED TYPES INTELLISENSE COMPILER CATCHES ERRORS
  • 34. TYPE SAFETY CODE SAFETY OBJECT GRAPHS DEBUGGING STATIC CODE ANALYSIS SEALED TYPES INTELLISENSE COMPILER CATCHES ERRORS
  • 35.
  • 38. 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
  • 39. WHAT IS THIS? AND WHY IS IT HERE?
  • 40. WHAT IS THIS? AND WHY IS IT HERE?
  • 41. WHAT IS THIS? AND WHY IS IT HERE?
  • 42. WHAT IS THIS? AND WHY IS IT HERE?
  • 44. Open Classes CREDIT: HTTP://COMMONS.WIKIMEDIA.ORG/WIKI/ FILE:NEON_OPEN_SIGN.JPG
  • 46. method_missing CREDIT: HTTP://WWW.FLICKR.COM/ PHOTOS/TAITOH/3029653729/
  • 47. Dynamism CREDIT: HTTP://WWW.FLICKR.COM/PHOTOS/ LABGUEST/3510995344/
  • 48. RubyGems Standardized Packaging System Central Repository for hosting packages Allows for installation and management of multiple installed versions
  • 50. RubyGems THAT’S IT!
  • 53. IronRuby Basics Installing http://ironruby.net/Download
  • 54. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer
  • 55. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer ???
  • 56. IronRuby Basics Installing http://ironruby.net/Download Download Windows Installer ??? Profit!!!
  • 58. IronRuby Basics ..and what did we just install?
  • 59. IronRuby Basics ..and what did we just install? bin - IronRuby executables (ir.exe, etc)
  • 60. IronRuby Basics ..and what did we just install? bin - IronRuby executables (ir.exe, etc) lib - Helpers for including assemblies and other common tasks
  • 61. 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
  • 62. 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
  • 63. 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)
  • 64. IronRuby Basics ..and, how the heck did it just do that? Runtime Call sites Binders Rules Common Language Runtime (CLR)
  • 65. IronRuby Basics ..and, how the heck did it just do that? Language Implementation Language ASTs Compiler Context Common Language Runtime (CLR)
  • 66. IronRuby Basics ..and, how the heck did it just do that? Common Hosting Model ScriptRuntime ScriptEngine ScriptScope ScriptSource Common Language Runtime (CLR)
  • 67. Integration Calling .NET from IronRuby Calling IronRuby from .NET WinForms / WPF / Silverlight Cucumber / RSpec
  • 68. 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

Notes de l'éditeur

  1. Sample Ruby App, Extend Access to .NET Object, Extend to pop up a WinForms MessageBox, Extend to do a 3D WPF “Hello MIX10!”
  2. Ruby to .NET - Thomas Sondergaard - 2003 Ruby CLR Project - Funded by Microsoft / Queensland Univ of Tech RubyCLR - John Lam’s first attempt
  3. Yep, it’s all about the magic. What kind of magic?
  4. Yep, it’s all about the magic. What kind of magic?
  5. This kind of magic
  6. So, Why Ruby? What’s so great about Ruby?
  7. So, Why Ruby? What’s so great about Ruby?
  8. So, Why Ruby? What’s so great about Ruby?
  9. So, Why Ruby? What’s so great about Ruby?
  10. So, Why Ruby? What’s so great about Ruby?
  11. So, Why Ruby? What’s so great about Ruby?
  12. So, Why Ruby? What’s so great about Ruby?
  13. So, Why Ruby? What’s so great about Ruby?
  14. So, Why Ruby? What’s so great about Ruby?
  15. But I hear many of you are quite skeptical.
  16. But I’m going to sidestep all of these with one statement
  17. But I’m going to sidestep all of these with one statement
  18. But I’m going to sidestep all of these with one statement
  19. But I’m going to sidestep all of these with one statement
  20. But I’m going to sidestep all of these with one statement
  21. But I’m going to sidestep all of these with one statement
  22. But I’m going to sidestep all of these with one statement
  23. But I’m going to sidestep all of these with one statement
  24. But I’m going to sidestep all of these with one statement
  25. Performance Implications next
  26. 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
  27. 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.
  28. 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.
  29. 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.
  30. 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.
  31. 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.
  32. 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.
  33. 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.
  34. 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.
  35. 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.
  36. 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.
  37. 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.