SlideShare a Scribd company logo
JRuby: Ready for ACTION! Charles Oliver Nutter and Thomas Enebo The JRuby Guys Sun Microsystems
Agenda JRuby overview JRuby enhancements and additions Swing programming Demo: Swing in Ruby Web applications Demo: JRuby on Rails Graphics and applets (that don't suck) Demo: Pretty graphics!
The JRuby Guys Charles Oliver Nutter and Thomas Enebo Longtime Java developers (10+ yrs each) Engineers at Sun Microsystems for 1 yr Full-time JRuby developers Also working on JVM dynlang support Wide range of past experience C, C++, C#, Perl, Python, Delphi, Lisp, Scheme Java EE and ME, JINI, WS
JRuby Java implementation of Ruby language “It's just Ruby!” Started in 2002, open source, many contributors Ola Bini, Marcin Mielzinsky, Nick Sieger, Bill Dortch, Vladimir Sizikov, MenTaLguY Aiming for compatibility with current Ruby version Ruby 1.8.6 patchlevel 111 (114 was just released) Improvements on Ruby Native threading, better performance, many libraries
JRuby 1.1 Released! Announced today: JRuby 1.1 is finished! Massive improvements over 1.0 Full compiler for Ruby code to JVM bytecode Performance is many times better across the board New Regexp impl with full Oniguruma features New rewritten IO subsystem to parallel Ruby behavior Reduced memory footprint Best compatibility level ever Ready for production use (and already being used) Quick series of maintenance releases coming
Compatibility Applications are king Rails, Rubygems, Rake, Rspec, ... Testing rulez (~42,000 expectations/assertions) Prevents regressions Helps to better define Ruby Prevents fragmenting a community Like Sapphire or ...Sapphire???
Java == A Dirty Word “The answer is Java.  What is the Question?”
Java != A Dirty Word
Java != A Dirty Word Fantastic Virtual Machine Tuned for over a decade by an army Runs on virtually all os/hardware combos Dynamic optimizations (Hotspot) Keeps getting faster: Java 5  Java 6 Rexml  10.9s  7.41s  %32  Hpricot  4.06s  2.59s  %36
Java != A Dirty Word Fantastic Garbage Collectors Compacting Concurrent Many tunables and choices
Java != A Dirty Word Native threading Tools IDEs (refactoring, debugging) Profilers (instrumenting, sampling) JMX (ask VM for stats) Libraries Anything you can think of... Write image_science in 60 lines of Ruby using Java 2D
Where is JRuby being used? Swing GUI development Makes Swing much nicer to use, easier to handle Ruby on Rails Better deployment options, better performance Tooling for IDEs JRuby's parser enables NetBeans, Eclipse, IntelliJ Graphics Ruby + Processing = cool demos
Swing GUI Programming Swing API is very large, complex Ruby magic simplifies most of the tricky bits Java is a very verbose language Ruby makes Swing actually fun No consistent cross-platform GUI library for Ruby Swing works everywhere Java does (everywhere) No fire-and-forget execution No dependencies: any script works on any JRuby install
Option 1: Direct approach import javax.swing. JFrame import javax.swing. JButton frame =  JFrame .new( " Swing is easy now! " ) frame.set_size  300 ,  300 frame.always_on_top =  true button =  JButton .new( " Press me! " ) button.add_action_listener  do  |evt| evt.source.text =  " Don't press me again! " evt.source.enabled =  false end frame.add(button) frame.show
DEMO Swing in Ruby
Option 2: Cheri (builder approach) include  Cheri :: Swing frame = swing.frame( " Swing builders! " ) { |form| size  300 ,  300 box_layout form,  :Y_AXIS content_pane { background  :WHITE  } button( " Event binding is nice " ) { |btn| on_click { btn.text =  " You clicked me! "  } } } frame.visible =  true
Option 3: Profligacy (targeted fixes) class   ProfligacyDemo import javax.swing.* include  Profligacy def   initialize layout =  &quot; [<translate][*input][>result] &quot; @ui  =  Swing :: LEL .new( JFrame , layout) {|cmps, ints| cmps.translate =  JButton .new( &quot; Translate &quot; ) cmps.input =  JTextField .new cmps.result =  JLabel .new translator = proc {|id, evt| original =  @ui .input.text translation =  MyTranslator .translate(original) @ui .result.text = translation } ints.translate = { :action  => translator} } end end
Option 4: MonkeyBars (tool-friendly) GUI editor friendly (e.g. NetBeans “Matisse”) Simple Ruby MVC-based API Combines best of both worlds
MonkeyBars + NetBeans Matisse
MonkeyBars Controller class   RssController  <  Monkeybars :: Controller set_view  &quot; RssView &quot; set_model  &quot; RssModel &quot; close_action  :exit add_listener  :type  =>  :mouse ,  :components  => [ &quot; goButton &quot; ,  &quot; articleList &quot; ] def   go_button_mouse_released (view_state, event) model.feed_url = view_state.feed_url content =  Kernel .open(model.feed_url).read @rss  =  RSS :: Parser .parse(content,  false ) model.articles =  @rss .items.map {|art| art.title} model.article_text = CGI .unescapeHTML( @rss .items[ 0 ].description) update_view end ...
Web applications Classic Java web dev is too complicated Modern frameworks follow Rails' lead Over-flexible, over-configured Conventions trump repetition and configuration Rails deployment is still a pain You shouldn't need N processes! Rails performance should be better JRuby has potential to be much faster
Production JRuby on Rails Oracle's Mix – digg-like social customer site mix.oracle.com Sun's MediaCast – file distribution portal mediacast.sun.com ThoughtWorks' Mingle – collaborative project mgmt mingle.thoughtworks.com Sonar – code/project analysis tool sonar.hortis.ch More on the way!
DEMO GlassFish Gem
JRuby Enables Tooling JRuby's parser used by most Ruby IDEs NetBeans Ruby Support Eclipse RDT/RadRails/Aptana, DLTK, 3 rd  Rail IntelliJ Jedit Roman Strobl's NetBeans session at 13:00
Graphics with Processing “Processing is an open source programming language and environment for people who want to program images, animation, and interactions.” Basically a cool Java library for 2D graphics Ruby-Processing wraps Processing with JRuby Cool, rubified 2D graphics environment for you Eye-candy demos for us Thanks to Jeremy Ashkenas for putting these together
DEMO Pretty Graphics!
Thank you! Main JRuby page:  www.jruby.org JRuby Wiki: wiki.jruby.org Charles Nutter [email_address] headius.blogspot.com Tom Enebo [email_address] www.bloglines.com/blog/ThomasEEnebo
JRuby: Ready for ACTION! Charles Oliver Nutter and Thomas Enebo The JRuby Guys Sun Microsystems

More Related Content

PPTX
Build RESTful API Using Express JS
PDF
CoffeeScript Design Patterns
PDF
Happy Programming with CoffeeScript
PDF
Avoiding Common Pitfalls in Ember.js
PDF
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
PDF
Zepto and the rise of the JavaScript Micro-Frameworks
PDF
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
PPTX
Baking in the cloud with packer and puppet
Build RESTful API Using Express JS
CoffeeScript Design Patterns
Happy Programming with CoffeeScript
Avoiding Common Pitfalls in Ember.js
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Zepto and the rise of the JavaScript Micro-Frameworks
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
Baking in the cloud with packer and puppet

What's hot (20)

PPTX
Flu3nt highlights
PDF
CoffeeScript-Ruby-Tuesday
PDF
CoffeeScript in 5mins
PDF
High Performance JavaScript - WebDirections USA 2010
PDF
On Selecting JavaScript Frameworks (Women Who Code 10/15)
PPTX
Module design pattern i.e. express js
PDF
APIs for modern web apps
KEY
WebGL Camp 4 - A3 3D Engine
PDF
Practical automation for beginners
KEY
Smalltalk in the pocket - Building applications for the iPhone
PDF
Node.js Development Workflow Automation with Grunt.js
PPTX
Simplicity - develop modern web apps with tiny frameworks and tools
PDF
High Performance JavaScript - jQuery Conference SF Bay Area 2010
PDF
Tide - The missing web framework
PDF
Testing Mobile JavaScript
KEY
CoffeeScript presentation
PDF
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
PDF
Mastering Grunt
PDF
How I learned to stop worrying and love embedding JavaScript
PDF
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Flu3nt highlights
CoffeeScript-Ruby-Tuesday
CoffeeScript in 5mins
High Performance JavaScript - WebDirections USA 2010
On Selecting JavaScript Frameworks (Women Who Code 10/15)
Module design pattern i.e. express js
APIs for modern web apps
WebGL Camp 4 - A3 3D Engine
Practical automation for beginners
Smalltalk in the pocket - Building applications for the iPhone
Node.js Development Workflow Automation with Grunt.js
Simplicity - develop modern web apps with tiny frameworks and tools
High Performance JavaScript - jQuery Conference SF Bay Area 2010
Tide - The missing web framework
Testing Mobile JavaScript
CoffeeScript presentation
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Mastering Grunt
How I learned to stop worrying and love embedding JavaScript
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Ad

Viewers also liked (7)

PPT
Google既有商業模式的破壞者
PDF
Luong toi thieu 2014
PPT
Meryem Karmani 3
PPT
La ViolèNcia De GèNere
PPT
La Mia Autobiografia Olha 3
PPT
Savanna Powerpoint
Google既有商業模式的破壞者
Luong toi thieu 2014
Meryem Karmani 3
La ViolèNcia De GèNere
La Mia Autobiografia Olha 3
Savanna Powerpoint
Ad

Similar to EuRuKo JRuby Talk 2008 (20)

PPTX
Why Ruby?
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
PDF
Why Node.js
PDF
Why Nodejs Guilin Shanghai
KEY
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
PDF
Developing cross platform desktop application with Ruby
PDF
Node azure
PPTX
From Ant to Rake
PDF
JRuby - Enterprise 2.0
KEY
Ruby on Rails survival guide of an aged Java developer
PDF
JavaScript Libraries: The Big Picture
KEY
node.js: Javascript's in your backend
PDF
Get Ahead with HTML5 on Moible
PDF
Web Development using Ruby on Rails
PDF
Connecting the Worlds of Java and Ruby with JRuby
PPTX
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
PPT
Ruby On Rails Presentation
PPTX
JRuby in Java Projects
PPTX
Java script unit testing
Why Ruby?
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Why Node.js
Why Nodejs Guilin Shanghai
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Developing cross platform desktop application with Ruby
Node azure
From Ant to Rake
JRuby - Enterprise 2.0
Ruby on Rails survival guide of an aged Java developer
JavaScript Libraries: The Big Picture
node.js: Javascript's in your backend
Get Ahead with HTML5 on Moible
Web Development using Ruby on Rails
Connecting the Worlds of Java and Ruby with JRuby
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
Ruby On Rails Presentation
JRuby in Java Projects
Java script unit testing

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx

EuRuKo JRuby Talk 2008

  • 1. JRuby: Ready for ACTION! Charles Oliver Nutter and Thomas Enebo The JRuby Guys Sun Microsystems
  • 2. Agenda JRuby overview JRuby enhancements and additions Swing programming Demo: Swing in Ruby Web applications Demo: JRuby on Rails Graphics and applets (that don't suck) Demo: Pretty graphics!
  • 3. The JRuby Guys Charles Oliver Nutter and Thomas Enebo Longtime Java developers (10+ yrs each) Engineers at Sun Microsystems for 1 yr Full-time JRuby developers Also working on JVM dynlang support Wide range of past experience C, C++, C#, Perl, Python, Delphi, Lisp, Scheme Java EE and ME, JINI, WS
  • 4. JRuby Java implementation of Ruby language “It's just Ruby!” Started in 2002, open source, many contributors Ola Bini, Marcin Mielzinsky, Nick Sieger, Bill Dortch, Vladimir Sizikov, MenTaLguY Aiming for compatibility with current Ruby version Ruby 1.8.6 patchlevel 111 (114 was just released) Improvements on Ruby Native threading, better performance, many libraries
  • 5. JRuby 1.1 Released! Announced today: JRuby 1.1 is finished! Massive improvements over 1.0 Full compiler for Ruby code to JVM bytecode Performance is many times better across the board New Regexp impl with full Oniguruma features New rewritten IO subsystem to parallel Ruby behavior Reduced memory footprint Best compatibility level ever Ready for production use (and already being used) Quick series of maintenance releases coming
  • 6. Compatibility Applications are king Rails, Rubygems, Rake, Rspec, ... Testing rulez (~42,000 expectations/assertions) Prevents regressions Helps to better define Ruby Prevents fragmenting a community Like Sapphire or ...Sapphire???
  • 7. Java == A Dirty Word “The answer is Java. What is the Question?”
  • 8. Java != A Dirty Word
  • 9. Java != A Dirty Word Fantastic Virtual Machine Tuned for over a decade by an army Runs on virtually all os/hardware combos Dynamic optimizations (Hotspot) Keeps getting faster: Java 5 Java 6 Rexml 10.9s 7.41s %32 Hpricot 4.06s 2.59s %36
  • 10. Java != A Dirty Word Fantastic Garbage Collectors Compacting Concurrent Many tunables and choices
  • 11. Java != A Dirty Word Native threading Tools IDEs (refactoring, debugging) Profilers (instrumenting, sampling) JMX (ask VM for stats) Libraries Anything you can think of... Write image_science in 60 lines of Ruby using Java 2D
  • 12. Where is JRuby being used? Swing GUI development Makes Swing much nicer to use, easier to handle Ruby on Rails Better deployment options, better performance Tooling for IDEs JRuby's parser enables NetBeans, Eclipse, IntelliJ Graphics Ruby + Processing = cool demos
  • 13. Swing GUI Programming Swing API is very large, complex Ruby magic simplifies most of the tricky bits Java is a very verbose language Ruby makes Swing actually fun No consistent cross-platform GUI library for Ruby Swing works everywhere Java does (everywhere) No fire-and-forget execution No dependencies: any script works on any JRuby install
  • 14. Option 1: Direct approach import javax.swing. JFrame import javax.swing. JButton frame = JFrame .new( &quot; Swing is easy now! &quot; ) frame.set_size 300 , 300 frame.always_on_top = true button = JButton .new( &quot; Press me! &quot; ) button.add_action_listener do |evt| evt.source.text = &quot; Don't press me again! &quot; evt.source.enabled = false end frame.add(button) frame.show
  • 16. Option 2: Cheri (builder approach) include Cheri :: Swing frame = swing.frame( &quot; Swing builders! &quot; ) { |form| size 300 , 300 box_layout form, :Y_AXIS content_pane { background :WHITE } button( &quot; Event binding is nice &quot; ) { |btn| on_click { btn.text = &quot; You clicked me! &quot; } } } frame.visible = true
  • 17. Option 3: Profligacy (targeted fixes) class ProfligacyDemo import javax.swing.* include Profligacy def initialize layout = &quot; [<translate][*input][>result] &quot; @ui = Swing :: LEL .new( JFrame , layout) {|cmps, ints| cmps.translate = JButton .new( &quot; Translate &quot; ) cmps.input = JTextField .new cmps.result = JLabel .new translator = proc {|id, evt| original = @ui .input.text translation = MyTranslator .translate(original) @ui .result.text = translation } ints.translate = { :action => translator} } end end
  • 18. Option 4: MonkeyBars (tool-friendly) GUI editor friendly (e.g. NetBeans “Matisse”) Simple Ruby MVC-based API Combines best of both worlds
  • 20. MonkeyBars Controller class RssController < Monkeybars :: Controller set_view &quot; RssView &quot; set_model &quot; RssModel &quot; close_action :exit add_listener :type => :mouse , :components => [ &quot; goButton &quot; , &quot; articleList &quot; ] def go_button_mouse_released (view_state, event) model.feed_url = view_state.feed_url content = Kernel .open(model.feed_url).read @rss = RSS :: Parser .parse(content, false ) model.articles = @rss .items.map {|art| art.title} model.article_text = CGI .unescapeHTML( @rss .items[ 0 ].description) update_view end ...
  • 21. Web applications Classic Java web dev is too complicated Modern frameworks follow Rails' lead Over-flexible, over-configured Conventions trump repetition and configuration Rails deployment is still a pain You shouldn't need N processes! Rails performance should be better JRuby has potential to be much faster
  • 22. Production JRuby on Rails Oracle's Mix – digg-like social customer site mix.oracle.com Sun's MediaCast – file distribution portal mediacast.sun.com ThoughtWorks' Mingle – collaborative project mgmt mingle.thoughtworks.com Sonar – code/project analysis tool sonar.hortis.ch More on the way!
  • 24. JRuby Enables Tooling JRuby's parser used by most Ruby IDEs NetBeans Ruby Support Eclipse RDT/RadRails/Aptana, DLTK, 3 rd Rail IntelliJ Jedit Roman Strobl's NetBeans session at 13:00
  • 25. Graphics with Processing “Processing is an open source programming language and environment for people who want to program images, animation, and interactions.” Basically a cool Java library for 2D graphics Ruby-Processing wraps Processing with JRuby Cool, rubified 2D graphics environment for you Eye-candy demos for us Thanks to Jeremy Ashkenas for putting these together
  • 27. Thank you! Main JRuby page: www.jruby.org JRuby Wiki: wiki.jruby.org Charles Nutter [email_address] headius.blogspot.com Tom Enebo [email_address] www.bloglines.com/blog/ThomasEEnebo
  • 28. JRuby: Ready for ACTION! Charles Oliver Nutter and Thomas Enebo The JRuby Guys Sun Microsystems