• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
J Ruby Whirlwind Tour
 

J Ruby Whirlwind Tour

on

  • 3,695 views

 

Statistics

Views

Total Views
3,695
Views on SlideShare
3,694
Embed Views
1

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 1

http://www.techgig.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    J Ruby Whirlwind Tour J Ruby Whirlwind Tour Presentation Transcript

    • JRuby Whirlwind Tour Ola Bini JRuby Core Developer ThoughtWorks Studios
    • About me • Ola Bini • From Stockholm, Sweden • Works for ThoughtWorks Studios in London • Programming language nerd
    • What is JRuby • Java implementation of the Ruby language • Current version 1.0 • Based on Ruby 1.8.5 • Started in 2001 • Currently 6 core developers • Open Source, about 30 contributors • ThoughtWorks offers commercial support
    • Why JRuby? • Performance • Native threading • Native Unicode support • Interpreted, compiled, mixed-mode, AOT, JIT • Java library integration (JDBC, XML, etc) • Enterprise acceptance
    • Demo: Interactive JRuby
    • Compatibility • Ruby has no official specification • ... and no complete suite of tests • We take what’s available for JRuby • Existing suites (BFTS, Rubicon, ruby_test) • Our own suite • Other tests (Rubinius) • Application test suites (RSpec, Rails, RubyGems)
    • JRuby runtime modes • Interpreted • Standard mode, fully implemented • Compilation • Not complete yet • AOT • JIT - Hot swap method implementations
    • JRuby on Rails • JRuby runs Rails very well • Improved deployment story • JDBC database connections • Performance • Integrate with Java infrastructure
    • ActiveRecord-JDBC • ActiveRecord adapter for JDBC drivers • Supports MySQL, Postgres, Oracle, Derby, MS SQL Server, HSQLDB, and more • Easy to add new databases
    • Goldspike • Support for packaging and serving Rails WAR files • Rails plugin, adds Rake tasks • Includes a RailsServlet • Can deploy to any compliant Java application server • Can run directly with embedded Jetty
    • Demo? JRuby on Rails
    • Mingle • Agile Project Intelligence • First commercial JRuby on Rails application • Originally choose JRuby for SVN plugins • Later used JRuby for: • Derby (embedded Java database) • Protecting source code • Easy bundling
    • Mingle+JRuby lessons • Mingle was originally developed in MRI • A LARGE test suite helps the migration • Running the Mingle test suite under JRuby is slightly slower than on MRI • ... but the actual application performs and scales better • Java Integration is MUCH easier than C extensions
    • YARV • Yet Another Ruby VM • Ruby 2.0 • JRuby have a simple YARVMachine • JRuby also have a simple YARV compiler • Work going on to replace interpreted mode with YARV interpretation instead
    • Rubinius • JRuby has a simple Rubinius machine • Not support for all Rubinius bytecodes • Why • Compatibility • Experimentation • Alternative to YARV for interpretation?
    • Testing • RSpec • RBehave • Test::Unit • Mocha • All works fine on JRuby • ... and can be used on Java classes too
    • Swing • Cheri • By JRuby Core Developer Bill Dortch • Nice Ruby wrapper around Swing • Profligacy • By Zed Shaw • Uses ASCII-pictures create layouts (LEL)
    • Profligacy example [ label_1 | label3 ] [ (300,300)*text1 | (150)people ] [ <label2 |_ ] [ message | buttons ]
    • Rubiq • Lisp layer on top of JRuby • Transforms to JRuby AST • ... and lets JRuby execute it • Rubiq is _very_ new (three days) • But will soon provide several interesting stuff
    • Rubiq features • Macros • Read macros (used to implement regexp syntax, for example) • Pure lexical scoping • Lambdas transparently transforms to blocks or Proc.new depending on location • Will not support most Ruby syntax • Principle of least Lisp-surprise
    • Under the hood • JRuby::ast_for(“1+1”) #-> Java AST • JRuby::ast_for { 1+1 } #-> Java AST • JRuby::compile(“1+1”) #-> CompiledScript • CompiledScript.inspect_bytecode • JRuby::runtime • JRuby::reference(“str”)
    • A JRuby future • Ruby objects right now descends from org.jruby.RubyObject • Planning to make most of the lightweight objects with behavior attached • Finish the compiler • Make YARV or Rubinius standard interpretation • Focus on surrounding projects
    • 24 September, ‘07
    • Resources • JRuby: www.jruby.org • ThoughtWorks Studios: studios.thoughtworks.com • Profligacy: ihate.rubyforge.org • JRuby-extras: jruby-extras.rubyforge.org • Rubiq: rubiq.googlecode.com • My blog: ola-bini.blogspot.com
    • ?