microsoft hellas dev days 09: ironruby

34
The .Net Ruby VM Dec 2009 ikos Dimitrakopoulos

Upload: nikos-dimitrakopoulos

Post on 08-May-2015

1.083 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Microsoft Hellas Dev Days 09: IronRuby

The .Net Ruby VM

Dec 2009Nikos Dimitrakopoulos

Page 2: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

2

Me

Software developer Pamediakopes.gr (now) Rento.gr (past) Individually (past + now)

Bachelor in Telecommunications (main emphasis on web) from University of Peloponnese

Programming experience: Ruby C# JavaScript Java, Objective-C, …

Page 3: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

3

Pamediakopes.gr

Travel agency Airtickets Hotels Ferry Tickets Car rentals …

Travel agency. But: Fully electronic Fully automated (ok, almost…) A software house

Tools of the trade: C#, SQL, ASP.Net, JavaScript plus a million different technologies for internal stuff (ruby,

python, c, …)

Page 4: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

4

Scope

Do the laundry Sys-admin Do small but amazingly repetitive tasks

Prototype – fast! Don’t reinvent the wheel!

Combine 2, 3 or 10s of different software ecosystems! Testing

Unit Functional Integration Easier/less time consuming than C# with NUnit (for

example)

Page 5: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

5

So?

Ruby is amazingly good for: Sys-admin scripts Implementing simple (and not so simple)

libraries Rapid prototyping

Rails Sinatra …

Reusing code Strong community & ecosystem after 2004 (Rails) Almost everything is Open Source

Page 6: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

6

Ruby

A fully Object-Oriented Language Everything is an object

Functional Paradigm Lambdas / procs map(), each(), inject()

Fully Dynamic Interpreted Dynamically typed Totally extensible (even core classes)

Page 7: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

7

Ruby

Cross platform Open source Multiple VMs

Vanilla Ruby (MRI, aka Matz’s Original Interpreter) Runs on all platforms C bindings

JRuby (On JVM, aka the Java Virtual Machine) Runs where Java Runs Java bindings

MacRuby (On Mac OS X) Runs on Mac OS X Objective-C & Cocoa bindings

Page 8: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

8

Ruby

Origins in Japan Zen is everywhere in the language

Simple Effective “No-fluff”

Page 9: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

9

Demo!

Page 10: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

10

Famous quotes

It doesn’t scale It’s slow It’s immature Not enterprise …

Page 11: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

11

But

jRuby MacRuby Rubinius MagLev IronRuby

Page 12: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

12

IronRuby

Page 13: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

13

Page 14: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

14

What is IronRuby

An alternative Ruby VM Implemented on top of the DLR Tight integration with .Net Part of the “Iron” languages

implemented in .Net Python Ruby LISP …

Page 15: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

15

A Ruby VM

Ruby interpreter (compliant with v 1.8.6) Faster than vanilla MRI Ruby (usually) Standard tools included:

Console (irb) Libraries (rubygems) Documentation (ri / RDoc)

Page 16: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

16

.Net Integration

Interoperability with .Net Consume all the C# code you want!

The huge .Net library ecosystem External .Net libraries Custom / existing C# code

Page 17: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

17

Additionally

“Translations” of idioms: object.SomeMethod() <-> object.some_method System.Core <-> System::Core

C# lambdas and delegates <-> Ruby clojures

>>> l = System::Byte.instance_methods(false).last=> 'get_type_code'

>>> l.ruby_name=> "get_type_code"

>>> l.clr_name=> "GetTypeCode"

Page 18: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

18

# Demo

Page 19: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

19

.Net Integration

Test .Net code with Cucumber & RSpec!

Page 20: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

20

# Demo

Page 21: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

21

.Net Integration

Extend existing .Net classes the ruby way!

Page 22: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

22

.Net Integration

Call ruby code from .Net!

Page 23: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

23

# Demo

Page 24: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

24

.Net Integration

Deploy on .Net infrastructure Web apps on IIS (Rails on .Net!) Consume Azure services! Use .Net services

SQL Office Active Directory Exchange etc...

Page 25: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

25

.Net Integration

Deploy on .Net infrastructure Desktop applications on Windows Desktop applications on everywhere (Mono)

Page 26: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

26

Additionally

Interoperability with the other scripting languages! Python …

Use code also from there!

Page 27: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

27

Silverlight

Silverlight integration Write ruby instead of javascript in your

pages! (Gestalt project)

Page 28: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

28

Silverlight

Page 29: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

29

Limitations

No support for native C gems Some rough edges in interoperability

Page 30: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

30

Status

RC1 Runs on .Net 3.5 & .Net 4.0 (different

builds) Passing ~93% of the Ruby specs Already faster than vanilla Ruby (in a lot of

cases) 1.0 expected soon

Full compatibility with Ruby 1.8.6 Common build for .Net 3.5 & .Net 4.0

(hopefully)

Page 31: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

31

Status

Page 32: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

32

Future

Speed Be on par with JRuby

Ruby 1.9 (maybe?) ???

Page 33: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

33

Thanks!

Thanks a lot & happy hacking!

Page 34: Microsoft Hellas Dev Days 09: IronRuby

Nikos Dimitrakopoulos on IronRuby Microsoft DevDays 2009

34

Links

IronRuby: http://ironruby.net/ http://ironruby.codeplex.com/

Rubyst.es http://rubyst.es http://groups.google.com/ruby-hellug

Pamediakopes http://www.pamediakopes.gr http://www.airtickets24.com

Me http://blog.nikosd.com http://twitter.com/nikosd nospam - at - nikosd - dom – com

Code samples : http://nikosd.com/f/ironruby-code-samples.zip