Ola Bini gave a whirlwind tour of JRuby, a Java implementation of the Ruby programming language. Some key points included: JRuby allows Ruby code to run on the Java virtual machine, taking advantage of features like native threading and access to Java libraries. It can run in several modes including interpreted, compiled, and just-in-time compiled. JRuby is commonly used to run Ruby on Rails applications, and tools like ActiveRecord-JDBC facilitate database access. Several other Ruby tools and frameworks like RSpec work with JRuby. Ola demonstrated several JRuby projects including Profligacy, Rubiq, and Swing wrappers. Future work includes finishing the compiler and exploring alternative interpreters like
2. About me
• Ola Bini
• From Stockholm, Sweden
• Works for ThoughtWorks Studios in London
• Programming language nerd
3. 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
6. 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)
7. JRuby runtime modes
• Interpreted
• Standard mode, fully implemented
• Compilation
• Not complete yet
• AOT
• JIT - Hot swap method implementations
8. JRuby on Rails
• JRuby runs Rails very well
• Improved deployment story
• JDBC database connections
• Performance
• Integrate with Java infrastructure
10. 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
12. 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
13. 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
14. 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
15. Rubinius
• JRuby has a simple Rubinius machine
• Not support for all Rubinius bytecodes
• Why
• Compatibility
• Experimentation
• Alternative to YARV for interpretation?
16. Testing
• RSpec
• RBehave
• Test::Unit
• Mocha
• All works fine on JRuby
• ... and can be used on Java classes too
17. Swing
• Cheri
• By JRuby Core Developer Bill Dortch
• Nice Ruby wrapper around Swing
• Profligacy
• By Zed Shaw
• Uses ASCII-pictures create layouts (LEL)
19. 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
20. 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
22. 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