Ruby &lt;3 .NET<br />Ivan Porto Carrero<br />http://flanders.co.nz<br />http://twitter.com/casualjim<br />www.visug.be<br />
Upcoming sessions<br />June 18 : Domain Driven Design (Yves Goeleven)<br />June 30 : IronRuby (Ivan Porto Carrero)<br />Se...
The plan<br />CLR, DLR, WTF??<br />All ur Rubyz are now belongs to us<br />Ruby why should I care?<br />Gotcha’s<br />BDD ...
CLR as we knew it<br />VB.NET<br />…<br />C#<br />Base Class Libraries<br />Common Type system<br />Security<br />Class Lo...
CLR but mo betterer<br />VB.NET<br />IronPython<br />C#<br />Base Class Libraries<br />DLR Runtime<br />Common Type system...
All urRubyz are now…<br />MRI ‐ “The Normal” Ruby <br />JRuby ‐ Sun <br />MacRuby ‐ Apple <br />IronRuby ‐ Microsoft <br /...
All urRubyz are now…<br />MRI ‐ “The Normal” Ruby <br />JRuby ‐ Sun <br />MacRuby ‐ Apple <br />IronRuby ‐ Microsoft <br /...
Why should I care?<br />For me the purpose of life is partly to have joy.<br />Programmers often feel joy when they can co...
Why should I care?<br />Actually, I&apos;m trying to make Ruby natural, not simple. <br />- Yukihiro “Matz” Matsumoto<br />
Best of breed<br />If Python was the result of Lisp and C++ having a baby,Ruby is the result of Perl and Smalltalk having ...
Duck typing<br />if it looks like a duck<br />and acts like a duck<br />it might as well be a duck<br />
Metaprogramming<br />The computer should be doing the hard work.<br />That’s what it’s paid to do, after all. <br />- Larr...
Metaprogramming<br />I don’t think the idea here is to save memory or speed.<br />The idea behind metaprogramming is<br />...
STOP!!!!       Demo time<br />
REPL<br />ReadEvalPrintLoop<br />ReadEvalPrintLoop<br />ReadEvalPrintLoop<br />ReadEvalPrint<br />
STOP!!!!       Demo time<br />
Everything is an object<br />I invented the term Object-Oriented,<br />and I can tell you I did not have C++ in mind <br /...
STOP!!!!       Demo time<br />
Classes are open<br />
STOP!!!!       Demo time<br />
CLR classes open for business<br />
STOP!!!!       Demo time<br />
Adding Iron to Ruby<br />I  have always imagined that paradise will be a kind of library<br />- Jorge Luis Borges<br />
Gotcha’s<br />
BDD Ruby/CLR interop<br />
IronRuby MVC<br />
Sinatra<br />
Silverlight<br />
Kweshiunz?<br />
“A language that doesn&apos;t  affect the way you think <br />about  programming is not worth knowing.” <br />- Alan Perli...
References<br />http://flanders.co.nz<br />http://ironruby.net<br />http://ironruby.info<br />http://iunknown.com<br />htt...
go_to(http://ironruby.net).play.create.have_fun<br />
Upcoming SlideShare
Loading in …5
×

Ruby Loves Dot Net

1,597 views
1,516 views

Published on

Presentation for the belgian VISUG about IronRuby

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

  • Be the first to like this

No Downloads
Views
Total views
1,597
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • IMHO Best IDE on the marketShared dynamic subsystemStandard hosting environmentBased on passing messages to objectsFull access to the CLREnable fast generation of dynamic codeOne true objectExplain how Jython was implemented and how it relates to the DLR
  • Here’s a list of the different implementations of ruby right now. • MRI stands for ‘Matz’s Ruby Interpreter’ - Matz is yukihiromatsumoto, a japanese guy who first created the ruby language back in 1993. It’s written in straight C. This what you get when you go to the official ruby website. • JRuby is an implementation of Ruby running on the JVM - it interops natively with java. Commercially backed by sun. • MacRuby is Ruby running on Apple’s Objective C runtime. It interops natively with ObjectiveC, which makes it ideal for writing OSX GUI applications. It’s in it’s early stages, commercially backed by apple. • IronRuby is microsoft’s version. Commercially backed by microsoft who employ full time staff working on it. This is what our presentation is about • Rubinius is a an implementation of Ruby running using a C++ Virtual machine. Commercially backed by engineyard, one of the biggest ruby on rails web hosting companies.• Maglev is by GemStone, who are a smalltalk company. They’ve been around for years and years writing big enterprise systems using smalltalk. Maglev is their project to run ruby on their smalltalk VM • Hotruby is a small open source thing which compiles ruby into javascript. Sounds ridiculous but people have run this using the V8 engine in Google Chrome and it actually works out to be faster than the other ruby implementations for whatever set of benchmarks they were running All these companies are putting some serious resources behind getting ruby to run on the systems they want. This is evidence that there must be SOMETHING to it.
  • Here’s a list of the different implementations of ruby right now. • MRI stands for ‘Matz’s Ruby Interpreter’ - Matz is yukihiromatsumoto, a japanese guy who first created the ruby language back in 1993. It’s written in straight C. This what you get when you go to the official ruby website. • JRuby is an implementation of Ruby running on the JVM - it interops natively with java. Commercially backed by sun. • MacRuby is Ruby running on Apple’s Objective C runtime. It interops natively with ObjectiveC, which makes it ideal for writing OSX GUI applications. It’s in it’s early stages, commercially backed by apple. • IronRuby is microsoft’s version. Commercially backed by microsoft who employ full time staff working on it. This is what our presentation is about • Rubinius is a an implementation of Ruby running using a C++ Virtual machine. Commercially backed by engineyard, one of the biggest ruby on rails web hosting companies.• Maglev is by GemStone, who are a smalltalk company. They’ve been around for years and years writing big enterprise systems using smalltalk. Maglev is their project to run ruby on their smalltalk VM • Hotruby is a small open source thing which compiles ruby into javascript. Sounds ridiculous but people have run this using the V8 engine in Google Chrome and it actually works out to be faster than the other ruby implementations for whatever set of benchmarks they were running All these companies are putting some serious resources behind getting ruby to run on the systems they want. This is evidence that there must be SOMETHING to it.
  • Many people that come to Ruby do so through the Rails framework.And then often you can hear these people say:I came for Rails but I stayed for Ruby
  • Ruby is a pleasant language to work with, partly because its well-chosen keywords, but mostly because it represents a kind of best breed implementation of a programming language. One of the goals ruby tries to achieve is to make the language you use ,when you’re writing your algorithms, a lot like a natural language. For example ruby has both the keywords if and unless, and you can apply those in 2 different ways. Best of breed Duck typing Everything is an object Classes are open / monkey patching Flexible Functional Procedural meta programming
  • Show some of the nicer ruby syntax
  • Regular expression literals [PERL] Strong text processing support [PERL] Blocks [SMALLTALK]Iterators [SMALLTALK]
  • Introduce blocksExplain about message receivers and message passingNote the string interpolation
  • Get into dynamic typing before duck typingRuby cares about typesIt cares about hierarchy + mixins when doing method lookupOnly safe operations against an object (no magic)Conversions explicit stepYou can override operators to allow for implicit conversion => explicit step + you’re in controlExplain how static typing resembles aristocracy with their bloodlines and how heritage is more important than capabilitiesExplain how duck typing focusses on the abilities of objects instead of their type. If the method is there it’s all good
  • Variables can change type =>sacreligion!We care about the size method on the receiver in get_count=> 1 reason type checking defferred to last responsible moment
  • metaprogramming == program to modify itself at runtime. metaprogramming == defining methods on instances and classes at runtime. You could very well generate most of a program at runtimeMostly used when DATA DRIVES THE CODE
  • Responding to unknown methods: method_missing Define methods programmatically String evaluation
  • See demos/metaprogramming.rbShow txt file content firstShow result of scriptOpen script start at bottomWalk through implementation
  • You can run ‘irb’ and just type some ruby code, and it runs as you go. This is a killer feature for when you’re testing, or when you’re learning a new API. I used to have to miss that when I was in .NET but that is a thing from the past now.
  • Require ‘mscorlib’Include System (equivalent of using in C#)Puts System.constantsPuts System.constants.grep(/^[A-C]/)
  • A class is a an object => class itself Nil => objectConstants => object
  • >>> 0.zero?=> true>>> 5.zero?=> false>>> 120/6=> 20>>> 873.class=> Fixnum>>> (1000 ** 1000).class=> Bignum >>> a = nil=> nil>>> a.nil?=> true>>> a.class=> NilClass
  • With great power comes great responsibility.You can extend classes at runtime and make api’s more wrist or read friendly
  • Ruby Loves Dot Net

    1. 1. Ruby &lt;3 .NET<br />Ivan Porto Carrero<br />http://flanders.co.nz<br />http://twitter.com/casualjim<br />www.visug.be<br />
    2. 2. Upcoming sessions<br />June 18 : Domain Driven Design (Yves Goeleven)<br />June 30 : IronRuby (Ivan Porto Carrero)<br />September 10 : ORMs, NHibernate – Entity Framework <br /> (Davy Brion, Kurt Claeys)<br />Week of October 5 (TBD) : Dino Esposito<br />November 18 : Modeling with VSTS2010 (Marcel De Vries)<br />November 26 : RIA Services (Miguel De Lathouwer<br /> & Steven Van Den Eynde)<br />
    3. 3.
    4. 4. The plan<br />CLR, DLR, WTF??<br />All ur Rubyz are now belongs to us<br />Ruby why should I care?<br />Gotcha’s<br />BDD with Bacon and Caricature<br />Sinatra has not left the building<br />IronRuby MVC<br />Ruby + Silverlight == Teh cake<br />
    5. 5. CLR as we knew it<br />VB.NET<br />…<br />C#<br />Base Class Libraries<br />Common Type system<br />Security<br />Class Loader, GC, JIT, Execution Support<br />
    6. 6. CLR but mo betterer<br />VB.NET<br />IronPython<br />C#<br />Base Class Libraries<br />DLR Runtime<br />Common Type system<br />Security<br />Class Loader, GC, JIT, Execution Support<br />
    7. 7.
    8. 8. All urRubyz are now…<br />MRI ‐ “The Normal” Ruby <br />JRuby ‐ Sun <br />MacRuby ‐ Apple <br />IronRuby ‐ Microsoft <br />Rubinius ‐ EngineYard<br />MagLev ‐ Gemstone <br />HotRuby<br />
    9. 9. All urRubyz are now…<br />MRI ‐ “The Normal” Ruby <br />JRuby ‐ Sun <br />MacRuby ‐ Apple <br />IronRuby ‐ Microsoft <br />Rubinius ‐ EngineYard<br />MagLev ‐ Gemstone <br />HotRuby<br />
    10. 10. Why should I care?<br />For me the purpose of life is partly to have joy.<br />Programmers often feel joy when they can concentrate<br />on the creative side of programming,<br />so Ruby is designed to make programmers happy. <br />- Yukihiro “Matz” Matsumoto<br />
    11. 11. Why should I care?<br />Actually, I&apos;m trying to make Ruby natural, not simple. <br />- Yukihiro “Matz” Matsumoto<br />
    12. 12.
    13. 13. Best of breed<br />If Python was the result of Lisp and C++ having a baby,Ruby is the result of Perl and Smalltalk having a baby. <br />- MeowMeow Jones, 11/8/2001 on slashdot.<br />
    14. 14.
    15. 15. Duck typing<br />if it looks like a duck<br />and acts like a duck<br />it might as well be a duck<br />
    16. 16.
    17. 17. Metaprogramming<br />The computer should be doing the hard work.<br />That’s what it’s paid to do, after all. <br />- Larry Wall<br />
    18. 18. Metaprogramming<br />I don’t think the idea here is to save memory or speed.<br />The idea behind metaprogramming is<br />to teach Ruby your conventions<br />And let it do some guessing<br />In order to save you some code <br />- Why, author of why’s poignant guide to Ruby<br />
    19. 19. STOP!!!! Demo time<br />
    20. 20. REPL<br />ReadEvalPrintLoop<br />ReadEvalPrintLoop<br />ReadEvalPrintLoop<br />ReadEvalPrint<br />
    21. 21. STOP!!!! Demo time<br />
    22. 22. Everything is an object<br />I invented the term Object-Oriented,<br />and I can tell you I did not have C++ in mind <br />- Alan Kay<br />
    23. 23. STOP!!!! Demo time<br />
    24. 24. Classes are open<br />
    25. 25. STOP!!!! Demo time<br />
    26. 26. CLR classes open for business<br />
    27. 27. STOP!!!! Demo time<br />
    28. 28. Adding Iron to Ruby<br />I have always imagined that paradise will be a kind of library<br />- Jorge Luis Borges<br />
    29. 29. Gotcha’s<br />
    30. 30. BDD Ruby/CLR interop<br />
    31. 31. IronRuby MVC<br />
    32. 32. Sinatra<br />
    33. 33. Silverlight<br />
    34. 34. Kweshiunz?<br />
    35. 35. “A language that doesn&apos;t affect the way you think <br />about programming is not worth knowing.” <br />- Alan Perlis<br />
    36. 36. References<br />http://flanders.co.nz<br />http://ironruby.net<br />http://ironruby.info<br />http://iunknown.com<br />http://manning.com/carrero<br />http://rubydoes.net<br />http://blog.prokrams.com/<br />http://nightlybuilds.cloudapp.net/Project.aspx?project=dlr<br />http://blog.jimmy.schementi.com/<br />
    37. 37. go_to(http://ironruby.net).play.create.have_fun<br />

    ×