SlideShare a Scribd company logo
1 of 91
Download to read offline
Connecting
Java and Ruby
Nick Sieger :: December 14, 2010
To begin at 10 AM Pacific.
Audio or visual issues?
Call 24/7 WebEx Tech Support (866) 229-3239
Slides: http://j.mp/ey-jruby-connecting
Connecting
Java and Ruby
Nick Sieger :: December 14, 2010
JRuby: Bridge Between Two Worlds




                 http://www.flickr.com/photos/hb2/288721287/
Bridges facilitate...




                 Cross-
Movement                      Collaboration   Trading
                pollination
Bridge from Ruby to Java




http://www.flickr.com/photos/orbitaljoe/4038901965/   http://www.flickr.com/photos/the_rev/2295096211/
Bridge from Java to Ruby




             http://www.flickr.com/photos/design-dog/1268749868/
Bridge from Enterprise to Cloud




 http://www.flickr.com/photos/nzdave/347532488/   http://www.flickr.com/photos/ancawonka/65927497/
Bridge from Legacy to Greenfield




 http://www.flickr.com/photos/cobalt/318394059/   http://www.flickr.com/photos/13010608@N02/2441101211/
Ruby
Dynamic language of the cloud
A word about
 scripting...
   It’s for kiddies.
Ruby: Dynamic,
   Object-Oriented




http://www.flickr.com/photos/listenmissy/4869202176/
Ruby: Duck-Typing



def area(width = 10, height = 2 * width)
  width * height
end

p   area           #   =>   200
p   area 5         #   =>   50
p   area 5, 20     #   =>   100
p   area "10", 4   #   =>   ?
Ruby: Duck-Typing



p area "10", 4 # => "10101010"

# From Ruby API docs:

#   String#*(num)
#
#   Returns a new String containing num copies of
#   the receiver.
#
#      "Ho! " * 3   #=> "Ho! Ho! Ho! "

area true, false
  # => NoMethodError: undefined method `*' for
  #      true:TrueClass
Ruby: Flexible Syntax



def set_options(env, opts)
end

set_options(:production, {"caching" => "on", "debug" => "false"})

set_options(:production,   "caching" => "on", "debug" => "false")

set_options :production, {"caching" => "on", "debug" => "false"}

set_options :production,   "caching" => "on", "debug" => "false"
Ruby: Blocks



         list = [1, 2, 3, 4]

         list.each {|n| puts n }
  Ruby
         list.each do |n|
           puts n
         end



         List<Integer> list = Arrays.asList(1, 2, 3, 4);

  Java   for (Integer n : list) {
             System.out.println(n);
         }
Ruby: Blocks



         list.shuffle!
           # => [3, 1, 4, 2]
  Ruby
         p list.sort {|a, b| b <=> a }
           # => [4, 3, 2, 1]


         Collections.shuffle(list);

         Collections.sort(list, new Comparator<Integer>() {
                 public int compare(Integer a, Integer b) {
  Java               return b > a ? 1 : (b < a ? -1 : 0);
                 }
             });

         System.out.println(list);
Ruby: Blocks



         File.open(__FILE__) do |file|
           file.each_line do |line|
  Ruby       puts line
           end
         end



         BufferedReader file =
             new BufferedReader(new FileReader("Blocks.java"));
         try {
             String line;
             while ((line = buf.readLine()) != null) {
  Java           System.out.println(line);
             }
         } finally {
             file.close();
         }
Ruby: Open Classes




     msg = "Scramble this so you can't read it!"
     msg.rot13!

       # => NoMethodError: undefined method `rot13!' for
       #    "Scramble this so you can't read it!":String
Ruby: Open Classes



     class String
       def rot13!
         0.upto(length - 1) do |i|
           case self[i]
           when ?a..?z
              self[i] = ?a + ((self[i] - ?a) + 13) % 26
           when ?A..?Z
              self[i] = ?A + ((self[i] - ?A) + 13) % 26
           end
         end
         self
       end
     end
Ruby: Open Classes




       puts msg.rot13!
         # => "Fpenzoyr guvf fb lbh pna'g ernq vg!"
       puts msg.rot13!
         # => "Scramble this so you can't read it!"
Ruby: Interactive




   $ irb
   irb(main):001:0> list = [1, 2, 3, 4]
   => [1, 2, 3, 4]
   irb(main):002:0> list.shuffle.map {|x| x + rand(10)}.sort
   => [6, 7, 11, 13]
   irb(main):003:0> list
   => [1, 2, 3, 4]
Ruby: Interactive




   irb(main):004:0> require 'irb/completion'
   => true
   irb(main):005:0> list.<TAB>
   Display all 138 possibilities? (y or n)
   irb(main):005:0> list.d<TAB>
   list.delete       list.delete_at    list.delete_if    list.detect
   list.display      list.drop         list.drop_while   list.dup
Ruby: Developer Happiness




               =
RubyGems
Testing in Ruby




RSpec
http://rspec.info/   http://cukes.info/
Ruby: Summary


                      • Organize code the way you want
   Dynamic and Open   • Associate behavior with the correct class
                      • No more “Util” classes




                      • Express code intent succinctly
   Flexible           • Strip away unnecessary ceremony




                      • Try out code and get instant feedback
   Interactive        • Learn by doing




                      • Productivity gains lead to increased pleasure
   Happy              • Enjoy crafting clean code
Rails
Dynamic framework of the cloud
Rails: Opinionated Framework




              Request-     Convention    Defaults
  Place for
               based          over        with
 everything
                MVC       Configuration   Choices
Rails: Place for All Your Code



                           application code
                          configuration & environments
                          routes (URL structure)

                          database migrations

                          static assets
                          (images, stylesheets, javascript)

                          tests
Rails: Request-based MVC




   Request   Routing    Controller
                                        Model
              Action     Action
                                     ActiveRecord
             Dispatch   Controller




                          View
                                      Database
  Response              ActionView
Rails: Convention over Configuration


  URL          GET /people

               resources :people
  Routing
                 #=> people#index

               # app/controllers/people_controller.rb
               class PeopleController < ApplicationController
                 def index
  Controller
                   @people = Person.all
                 end
               end

               # app/models/person.rb
  Model        class Person < ActiveRecord::Base
               end

  View         app/views/people/index.html.erb
Rails: Defaults with Choices


                       Default        Alternatives

                                      DataMapper, MongoMapper,
ORM                    ActiveRecord   Sequel, Any object with
                                      ActiveModel

                                      HAML, Builder XML,
View Templates         ERb            Markaby, RedCloth (Textile),
                                      BlueCloth (Markdown)

JavaScript Framework   Prototype      jQuery

                                      MySQL, PostgreSQL, Oracle,
Database               SQLite3
                                      more via JRuby + JDBC


Test Framework         Test::Unit     RSpec, Cucumber
Why Rails?




              COMPARING JVM WEB
                 FRAMEWORKS
                                 Matt Raible
                           http://raibledesigns.com




                 Images by Stuck in Customs - http://www.flickr.com/photos/stuckincustoms
                                                                                           © 2010, Raible Designs
                                            © 2010 Raible Designs




             http://j.mp/raible-jvm-frameworks
Why Rails?




Consider...


              Information                  Available
 Project                    Development
                 Books,                     skilled
 maturity                      speed
                  Docs                    developers
Installing Rails
 INSTALL   gem install rails
Rails: New Application




$ rails new coolapp -m http://jruby.org
      create
      create README
      create Rakefile
      ...
Rails: Dependencies with Bundler



 $ cd coolapp

 $ bundle install
 Fetching source index for http://rubygems.org/
 Using rake (0.8.7)
 Using abstract (1.0.0)
 ...
 Using rails (3.0.3)
 Your bundle is complete!
Rails: Generate Scaffolding




$ rails generate scaffold person email:string password:string
      invoke active_record
      create    db/migrate/20101214020707_create_people.rb
      create    app/models/person.rb
      invoke    test_unit
      create      test/unit/person_test.rb
      create      test/fixtures/people.yml
       route resources :people
         ...
Rails: Migrate Database




$ rake db:migrate
(in /Users/nicksieger/Projects/rails/coolapp)
== CreatePeople: migrating ===========================
-- create_table(:people)
   -> 0.0040s
   -> 0 rows
== CreatePeople: migrated (0.0040s) ==================
Rails: Start Dev Server




$ rails server
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-12-13 20:11:28] INFO WEBrick 1.3.1
[2010-12-13 20:11:28] INFO ruby 1.8.7 (2010-12-10) [java]
[2010-12-13 20:11:28] INFO WEBrick::HTTPServer#start: pid=21022 port=3000
Rails: First Page
Rails: Console




$ rails console
Loading development environment (Rails 3.0.3)
irb(main):001:0> Person.create :email => "nsieger@engineyard.com", :password => "rails"
=> #<Person id: 1, email: "nsieger@engineyard.com", password: "rails", created_at:
"2010-12-14 02:21:11", updated_at: "2010-12-14 02:21:11">
Real-world
  Rails
https://joindiaspora.com/




                            https://github.com/diaspora/diaspora
Routes




         # config/routes.rb (abbreviated)
         Diaspora::Application.routes.draw do
           # ...
           resources :photos, :except => [:index]

           #...
           root :to => 'home#show'
         end
Rails: RESTful Routes

Verb        Path               Action    Used for

                                         display a list of all
GET         /photos            index
                                         photos
                                         return an HTML form for
GET         /photos/new        new
                                         creating a new photo

POST        /photos            create    create a new photo

GET         /photos/:id        show      display a specific photo

                                         return an HTML form for
GET         /photos/:id/edit   edit
                                         editing a photo

PUT         /photos/:id        update    update a specific photo

DELETE      /photos/:id        destroy   delete a specific photo
Rails: RESTful Routes

Verb        Path                   Action    Used for

                                             display a list of all
GET         /photos                index
             :except => [:index]             photos
                                             return an HTML form for
GET         /photos/new            new
                                             creating a new photo

POST        /photos                create    create a new photo

GET         /photos/:id            show      display a specific photo

                                             return an HTML form for
GET         /photos/:id/edit       edit
                                             editing a photo

PUT         /photos/:id            update    update a specific photo

DELETE      /photos/:id            destroy   delete a specific photo
Controller



 # app/controllers/photos_controller.rb (abbr.)
 class PhotosController < ApplicationController
   respond_to :html
   respond_to :json, :only => :show

   def show
     @photo = current_user.find_visible_post_by_id params[:id]
     # ...
     respond_with @photo
   end
 end
Model



 # app/models/photo.rb (abbreviated)
 class Photo < Post
   include MongoMapper::Document

   require 'carrierwave/orm/mongomapper'
   mount_uploader :image, ImageUploader

   key :caption, String
   key :status_message_id, ObjectId

   belongs_to :status_message

   validate :ownership_of_status_message

   before_destroy :ensure_user_picture
 end
View




       Rendering photo list
HAML View



  -# app/views/people/show.html.haml (abbr.)
  .span-15.last
    %h4
      = t('_photos')
    = render 'photos/index', :photos => @posts


  -# app/views/photos/_index.html.haml (abbr.)
  #thumbnails.span-15.last
    - for photo in photos
      = link_to photo.url(:thumb_medium), photo_path(photo)
Rendered HTML View



<div class='span-15 last'>
  <h4>
    photos
  </h4>
  <div class='span-15 last' id='thumbnails'>
    <a href="/photos/4d0694d..."><img src="/uploads/images/..." /></a>
    <a href="/photos/4d06949..."><img src="/uploads/images/..." /></a>
    <a href="/photos/4d068b2..."><img src="/uploads/images/..." /></a>
  </div>
</div>
Rails: Summary


                             • No wasting time deciding where to put something
    Place for Everything &
                             • Shared conventions get team members up to
    Conventions                speed quickly




                             • No wasted effort getting started
    Defaults with Choices    • Easy to add/change components later




                             • Development: “code and reload”
    Environments             • Test: disposable data
                             • Production: cache and optimize




                             • Mature framework, frequent updates
    Community                • Rich catalog of plugins
                             • Rails programmers are in-demand
Dynamic toolkit of the cloud
Getting JRuby


  OS                   How to get

                       •http://jruby.org/download
  All                  •Ruby Version Manager (RVM)
                        http://rvm.beginrescueend.com/

  Windows              •Installer from http://jruby.org/download

  Mac OS X
                       •Homebrew - brew install jruby
                       •MacPorts - port install jruby
  Ubuntu/Debian        •apt-get install jruby (may not be up-to-date,
                       may need multiverse)
  Fedora/RHEL/Centos   •yum   install jruby (may not be up-to-date)

  Gentoo               •emerge   dev-java/jruby (may be old)


             http://wiki.jruby.org/JRubyDistributions
Using JRuby



 $ jruby script.rb      Run a standalone script

 $ jruby -S gem ...     Run Rubygems, IRB, or an installed
                        gem (e.g, rake or rails)

 $ jruby -J-Xmx1G ...   Pass arguments to the JVM

 $ jruby --help         Get help
 $ jruby --properties
Access Java from JRuby

   require 'java'
   require 'rubygems'
   require 'flying_saucer'

   java_import org.xhtmlrenderer.pdf.ITextRenderer

   document = <<-HTML
   <html><body><h1>Hello Flying Saucer!</h1></body></html>
   HTML

   File.open("doc.pdf", "wb") do |out|
     renderer = ITextRenderer.new
     renderer.set_document_from_string document
     renderer.layout
     renderer.create_pdf out.to_outputstream
   end

   system("open doc.pdf")

   Tip: jruby -S gem install flying_saucer to try this example.
Access Java from JRuby


  $ jruby saucer.rb
Access Java from JRuby




                require 'java'




                                 Loads Java Integration
Access Java from JRuby




           require 'rubygems'
           require 'flying_saucer'




                 Loads Flying Saucer classes from Rubygems
Access Java from JRuby




 java_import org.xhtmlrenderer.pdf.ITextRenderer




                           Imports ITextRenderer class
Access Java from JRuby




  Ruby   renderer = ITextRenderer.new




  Java   ITextRenderer renderer = new ITextRenderer();




                                   Create new ITextRenderer
Access Java from JRuby




  Ruby   renderer.set_document_from_string document




  Java   renderer.setDocumentFromString(document);




                                   Set up the document
Access Java from JRuby




        File.open("doc.pdf", "wb") do |out|
          ...
          renderer.create_pdf out.to_outputstream
        end




                        Create PDF with explicit conversion
                        from Ruby IO to Java OutputStream
Integrating into Rails




         Mime::Type.register 'application/pdf', :pdf




                               Register PDF mime type in Rails
Integrating into Rails


class PhotosController
  private
  def pdf_to_string
    io = StringIO.new
    content = render_to_string
    renderer = ITextRenderer.new
    renderer.set_document_from_string(content)
    renderer.layout
    renderer.create_pdf(io.to_outputstream)
    io.string
  end
end
Integrating into Rails


class PhotosController
  def index
    @photos = Photos.all
    respond_to do |format|
      format.html
      format.pdf do
        send_data pdf_to_string, :filename => pdf_name + ".pdf",
          :type => 'application/pdf', :disposition => 'inline'
      end
    end
  end
end
Integrating into Rails




  http://example.com/photos       HTML view of photo listing

  http://example.com/photos.pdf   Inline PDF of photo listing
Rails 3 and JRuby




http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done
http://ci.jruby.org/
Rails Performance


http://github.com/wycats/rails-simple-benches

                   rails-simple N = 10,000                                rails-simple N = 10,000
15000                                                     120000
                  ruby 1.9.2                                                  ruby 1.9.2
12500             jruby-head client                       100000              jruby-head client
10000             jruby-head server                       80000               jruby-head server

7500                                                      60000
5000                                                      40000
2500                                                      20000
   0                                                          0
                                                                   partial_100 coll_100 uniq_100 diff_100
             ad


                     x



                              1

                                     al


                                               10

                                                     10
                    de



                              e_

                                    rti


                                               _

                                                    ll_
         he




                            at




                                            al
                                   pa
                  in




                                                   co
        er




                                           rti
                          pl
        ov




                                          pa
                         m
                         te
JRuby Deployment




 Ruby servers      WAR files       PaaS


  WEBrick          GlassFish   EY AppCloud

  GF Gem            Tomcat      AppEngine

  Trinidad          JBoss      SteamCannon
Warbler




               INSTALL     gem install warbler




• Create a Java EE .war file from a Rails application
• “Looks like Java” to the ops staff



                                                        deploy
    Rails
                       warble             app.war       to java
    app
                                                       appserver
JRuby-Rack Servlet Filter



                                            /home.jsp:
                               Servlet         JSP
                              dispatch
                              pass-thru
  /home.jsp                                 /home/index:
               JRuby-Rack                       404
                RackFilter
                 doFilter
                              On 404:
 /home/index
                             Rails or any   /home/index:
                             Rack-based         Rails
                             application       Home-
                                              Controller
Hybrid Rails/Java Webapp




                      ActionDispatch


      Rails
      MVC       ActionController/ActionView


                       ActiveModel


               Java      JDBC            SOAP
              POJOs    DataSource      interface
Tools


                           http://www.jetbrains.com/ruby/

http://redcareditor.com/




                                       http://netbeans.org/
Enterprise
    Software
Evolving and adapting long-running
  projects with legacy codebases
http://en.wikipedia.org/wiki/File:Sagrada_Familia_01.jpg



Sagrada Família, Barcelona, Spain
http://www.flickr.com/photos/mgrenner57/263392884/

                                           1970s   early 2000s
http://www.flickr.com/photos/gonzalvo/4257293127/
http://www.flickr.com/photos/koocheekoo/38407225/




                                                                                                          http://www.flickr.com/photos/27649557@N07/5000528445/
                                                                              passion
                                                                              facade




                            nativity
                            facade



                                     scaffolded interior




                  http://www.flickr.com/photos/gpaumier/446059442/   http://www.flickr.com/photos/ilm/12831049/
http://en.wikipedia.org/wiki/File:Ryugyong_Hotel_October_2010.jpg
               2010
         Ryugyuong Hotel,
         North Korea
               2005
http://en.wikipedia.org/wiki/File:Ryugyong_Hotel_-_May_2005.JPG
http://en.wikipedia.org/wiki/File:ExteiorShearTruss.jpg




                                                                                       seismic retrofit




http://en.wikipedia.org/wiki/File:ExtReenfDetail.jpg
http://en.wikipedia.org/wiki/File:Szkieleteor_in_krakow.JPG


                                                                      Szkieletor,
                                                                      Kraków, Poland




                    http://www.flickr.com/photos/bazylek/3194294047/
Built Environment Metaphor



   Metaphor          Use Ruby, JRuby, and Rails to...



                     • Build a new facade faster with modern technology
   Sagrada Familia   • Scaffold portions of the application during refactoring




                     • Revive a languishing project by putting a new face on it
   Ryugyong Hotel


                     • Reinforce business rules with a DSL
   Seismic retrofit   • Harden security around an existing application




   Szkieletor        • Find novel uses for otherwise abandoned code
JRuby Stories: LinkedIn Signal




• High-volume social networking application
• http://www.infoq.com/articles/linkedin-scala-jruby-voldemort
• http://blog.linkedin.com/2010/09/29/linkedin-signal/
JRuby Stories: Tracker




• Protecting the world from terrorists!
• Export Control workflow system
• Used by US State dept. and other countries
• JRuby, Rails and legacy Java
• http://trackernet.org
• Making the World Safe For Democracy
   • David Bock, Arild Shirazi
   • http://vimeo.com/16270284
JRuby Events



               • JRubyConf 2009
                  • free event following RubyConf
                  • ~200 attendees
               • JRubyConf 2010
                  • standalone conference
                  • 150 attendees
               • JRuby meetups in SF Bay Area
               • http://www.meetup.com/SF-Bay-
                 Area-JRuby-Meetup/
Using JRuby
JRuby on AppCloud




                     JRuby +
                    AppCloud
Resources


• Contact me: Nick Sieger – nsieger@engineyard.com
• These slides: http://j.mp/ey-jruby-connecting
• JRuby.org – http://jruby.org/
• JRubyConf 2010 videos
   • http://j.mp/jrubyconf-2010-videos
• EY Blog: Resources for Getting Started with Ruby on Rails
   • http://j.mp/ey-getting-started-rails
• Rails for Zombies
   • http://railsforzombies.org/
Zero to Rails 3
Virtual Training
January 24-27, 2011 
http://www.eventbee.com/view/zero-to-rails-3
training@engineyard.com

Immediately following (optional):
Engine Yard AppCloud Demo
with Danish Khan
15-20 minute overview of AppCloud

More Related Content

What's hot

Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Charles Nutter
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & RailsPeter Lind
 
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Anton Arhipov
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015Charles Nutter
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes BackBurke Libbey
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMatt Butcher
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMTom Lee
 
TorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyTorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyBruno Oliveira
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyistsbobmcwhirter
 
Spring into rails
Spring into railsSpring into rails
Spring into railsHiro Asari
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torqueboxrockyjaiswal
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Anton Arhipov
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015Charles Nutter
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaKeith Bennett
 
Ruby - a tester's best friend
Ruby - a tester's best friendRuby - a tester's best friend
Ruby - a tester's best friendPeter Lind
 

What's hot (19)

Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & Rails
 
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVM
 
TorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyTorqueBox - When Java meets Ruby
TorqueBox - When Java meets Ruby
 
Rjb
RjbRjb
Rjb
 
TorqueBox for Rubyists
TorqueBox for RubyistsTorqueBox for Rubyists
TorqueBox for Rubyists
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
 
When Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of TorqueboxWhen Ruby Meets Java - The Power of Torquebox
When Ruby Meets Java - The Power of Torquebox
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
 
Ruby - a tester's best friend
Ruby - a tester's best friendRuby - a tester's best friend
Ruby - a tester's best friend
 

Viewers also liked

Concurrency patterns in Ruby
Concurrency patterns in RubyConcurrency patterns in Ruby
Concurrency patterns in RubyThoughtWorks
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder RubyNick Sieger
 
Warbler at RubyConf 2010
Warbler at RubyConf 2010Warbler at RubyConf 2010
Warbler at RubyConf 2010Nick Sieger
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011Nick Sieger
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger
 
Facility Layout in production management
Facility Layout in production managementFacility Layout in production management
Facility Layout in production managementJoshua Miranda
 

Viewers also liked (6)

Concurrency patterns in Ruby
Concurrency patterns in RubyConcurrency patterns in Ruby
Concurrency patterns in Ruby
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder Ruby
 
Warbler at RubyConf 2010
Warbler at RubyConf 2010Warbler at RubyConf 2010
Warbler at RubyConf 2010
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011
 
Facility Layout in production management
Facility Layout in production managementFacility Layout in production management
Facility Layout in production management
 

Similar to Connecting the Worlds of Java and Ruby with JRuby

Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortegaarman o
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVCSarah Allen
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Racksickill
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkDaniel Spector
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteDr Nic Williams
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Wen-Tien Chang
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleRaimonds Simanovskis
 
An introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsvinicorp
 
An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506Vu Hung Nguyen
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...Matt Gauger
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Nilesh Panchal
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsRaimonds Simanovskis
 

Similar to Connecting the Worlds of Java and Ruby with JRuby (20)

Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortega
 
Intro to Rails and MVC
Intro to Rails and MVCIntro to Rails and MVC
Intro to Rails and MVC
 
Oracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMsOracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMs
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
 
Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門Ruby on Rails : 簡介與入門
Ruby on Rails : 簡介與入門
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on Oracle
 
Play framework
Play frameworkPlay framework
Play framework
 
An introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-rails
 
An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
 
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
Ruby on-rails-101-presentation-slides-for-a-five-day-introductory-course-1194...
 
Speedy TDD with Rails
Speedy TDD with RailsSpeedy TDD with Rails
Speedy TDD with Rails
 
Bhavesh ro r
Bhavesh ro rBhavesh ro r
Bhavesh ro r
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on Rails
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Connecting the Worlds of Java and Ruby with JRuby

  • 1. Connecting Java and Ruby Nick Sieger :: December 14, 2010 To begin at 10 AM Pacific. Audio or visual issues? Call 24/7 WebEx Tech Support (866) 229-3239 Slides: http://j.mp/ey-jruby-connecting
  • 2. Connecting Java and Ruby Nick Sieger :: December 14, 2010
  • 3. JRuby: Bridge Between Two Worlds http://www.flickr.com/photos/hb2/288721287/
  • 4. Bridges facilitate... Cross- Movement Collaboration Trading pollination
  • 5. Bridge from Ruby to Java http://www.flickr.com/photos/orbitaljoe/4038901965/ http://www.flickr.com/photos/the_rev/2295096211/
  • 6. Bridge from Java to Ruby http://www.flickr.com/photos/design-dog/1268749868/
  • 7. Bridge from Enterprise to Cloud http://www.flickr.com/photos/nzdave/347532488/ http://www.flickr.com/photos/ancawonka/65927497/
  • 8. Bridge from Legacy to Greenfield http://www.flickr.com/photos/cobalt/318394059/ http://www.flickr.com/photos/13010608@N02/2441101211/
  • 10. A word about scripting... It’s for kiddies.
  • 11. Ruby: Dynamic, Object-Oriented http://www.flickr.com/photos/listenmissy/4869202176/
  • 12. Ruby: Duck-Typing def area(width = 10, height = 2 * width) width * height end p area # => 200 p area 5 # => 50 p area 5, 20 # => 100 p area "10", 4 # => ?
  • 13. Ruby: Duck-Typing p area "10", 4 # => "10101010" # From Ruby API docs: # String#*(num) # # Returns a new String containing num copies of # the receiver. # # "Ho! " * 3 #=> "Ho! Ho! Ho! " area true, false # => NoMethodError: undefined method `*' for # true:TrueClass
  • 14. Ruby: Flexible Syntax def set_options(env, opts) end set_options(:production, {"caching" => "on", "debug" => "false"}) set_options(:production, "caching" => "on", "debug" => "false") set_options :production, {"caching" => "on", "debug" => "false"} set_options :production, "caching" => "on", "debug" => "false"
  • 15. Ruby: Blocks list = [1, 2, 3, 4] list.each {|n| puts n } Ruby list.each do |n| puts n end List<Integer> list = Arrays.asList(1, 2, 3, 4); Java for (Integer n : list) { System.out.println(n); }
  • 16. Ruby: Blocks list.shuffle! # => [3, 1, 4, 2] Ruby p list.sort {|a, b| b <=> a } # => [4, 3, 2, 1] Collections.shuffle(list); Collections.sort(list, new Comparator<Integer>() { public int compare(Integer a, Integer b) { Java return b > a ? 1 : (b < a ? -1 : 0); } }); System.out.println(list);
  • 17. Ruby: Blocks File.open(__FILE__) do |file| file.each_line do |line| Ruby puts line end end BufferedReader file = new BufferedReader(new FileReader("Blocks.java")); try { String line; while ((line = buf.readLine()) != null) { Java System.out.println(line); } } finally { file.close(); }
  • 18. Ruby: Open Classes msg = "Scramble this so you can't read it!" msg.rot13! # => NoMethodError: undefined method `rot13!' for # "Scramble this so you can't read it!":String
  • 19. Ruby: Open Classes class String def rot13! 0.upto(length - 1) do |i| case self[i] when ?a..?z self[i] = ?a + ((self[i] - ?a) + 13) % 26 when ?A..?Z self[i] = ?A + ((self[i] - ?A) + 13) % 26 end end self end end
  • 20. Ruby: Open Classes puts msg.rot13! # => "Fpenzoyr guvf fb lbh pna'g ernq vg!" puts msg.rot13! # => "Scramble this so you can't read it!"
  • 21. Ruby: Interactive $ irb irb(main):001:0> list = [1, 2, 3, 4] => [1, 2, 3, 4] irb(main):002:0> list.shuffle.map {|x| x + rand(10)}.sort => [6, 7, 11, 13] irb(main):003:0> list => [1, 2, 3, 4]
  • 22. Ruby: Interactive irb(main):004:0> require 'irb/completion' => true irb(main):005:0> list.<TAB> Display all 138 possibilities? (y or n) irb(main):005:0> list.d<TAB> list.delete list.delete_at list.delete_if list.detect list.display list.drop list.drop_while list.dup
  • 26. Ruby: Summary • Organize code the way you want Dynamic and Open • Associate behavior with the correct class • No more “Util” classes • Express code intent succinctly Flexible • Strip away unnecessary ceremony • Try out code and get instant feedback Interactive • Learn by doing • Productivity gains lead to increased pleasure Happy • Enjoy crafting clean code
  • 28. Rails: Opinionated Framework Request- Convention Defaults Place for based over with everything MVC Configuration Choices
  • 29. Rails: Place for All Your Code application code configuration & environments routes (URL structure) database migrations static assets (images, stylesheets, javascript) tests
  • 30. Rails: Request-based MVC Request Routing Controller Model Action Action ActiveRecord Dispatch Controller View Database Response ActionView
  • 31. Rails: Convention over Configuration URL GET /people resources :people Routing #=> people#index # app/controllers/people_controller.rb class PeopleController < ApplicationController def index Controller @people = Person.all end end # app/models/person.rb Model class Person < ActiveRecord::Base end View app/views/people/index.html.erb
  • 32. Rails: Defaults with Choices Default Alternatives DataMapper, MongoMapper, ORM ActiveRecord Sequel, Any object with ActiveModel HAML, Builder XML, View Templates ERb Markaby, RedCloth (Textile), BlueCloth (Markdown) JavaScript Framework Prototype jQuery MySQL, PostgreSQL, Oracle, Database SQLite3 more via JRuby + JDBC Test Framework Test::Unit RSpec, Cucumber
  • 33. Why Rails? COMPARING JVM WEB FRAMEWORKS Matt Raible http://raibledesigns.com Images by Stuck in Customs - http://www.flickr.com/photos/stuckincustoms © 2010, Raible Designs © 2010 Raible Designs http://j.mp/raible-jvm-frameworks
  • 34. Why Rails? Consider... Information Available Project Development Books, skilled maturity speed Docs developers
  • 35. Installing Rails INSTALL gem install rails
  • 36. Rails: New Application $ rails new coolapp -m http://jruby.org create create README create Rakefile ...
  • 37. Rails: Dependencies with Bundler $ cd coolapp $ bundle install Fetching source index for http://rubygems.org/ Using rake (0.8.7) Using abstract (1.0.0) ... Using rails (3.0.3) Your bundle is complete!
  • 38. Rails: Generate Scaffolding $ rails generate scaffold person email:string password:string invoke active_record create db/migrate/20101214020707_create_people.rb create app/models/person.rb invoke test_unit create test/unit/person_test.rb create test/fixtures/people.yml route resources :people ...
  • 39. Rails: Migrate Database $ rake db:migrate (in /Users/nicksieger/Projects/rails/coolapp) == CreatePeople: migrating =========================== -- create_table(:people) -> 0.0040s -> 0 rows == CreatePeople: migrated (0.0040s) ==================
  • 40. Rails: Start Dev Server $ rails server => Booting WEBrick => Rails 3.0.3 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-12-13 20:11:28] INFO WEBrick 1.3.1 [2010-12-13 20:11:28] INFO ruby 1.8.7 (2010-12-10) [java] [2010-12-13 20:11:28] INFO WEBrick::HTTPServer#start: pid=21022 port=3000
  • 42. Rails: Console $ rails console Loading development environment (Rails 3.0.3) irb(main):001:0> Person.create :email => "nsieger@engineyard.com", :password => "rails" => #<Person id: 1, email: "nsieger@engineyard.com", password: "rails", created_at: "2010-12-14 02:21:11", updated_at: "2010-12-14 02:21:11">
  • 44. https://joindiaspora.com/ https://github.com/diaspora/diaspora
  • 45. Routes # config/routes.rb (abbreviated) Diaspora::Application.routes.draw do # ... resources :photos, :except => [:index] #... root :to => 'home#show' end
  • 46. Rails: RESTful Routes Verb Path Action Used for display a list of all GET /photos index photos return an HTML form for GET /photos/new new creating a new photo POST /photos create create a new photo GET /photos/:id show display a specific photo return an HTML form for GET /photos/:id/edit edit editing a photo PUT /photos/:id update update a specific photo DELETE /photos/:id destroy delete a specific photo
  • 47. Rails: RESTful Routes Verb Path Action Used for display a list of all GET /photos index :except => [:index] photos return an HTML form for GET /photos/new new creating a new photo POST /photos create create a new photo GET /photos/:id show display a specific photo return an HTML form for GET /photos/:id/edit edit editing a photo PUT /photos/:id update update a specific photo DELETE /photos/:id destroy delete a specific photo
  • 48. Controller # app/controllers/photos_controller.rb (abbr.) class PhotosController < ApplicationController respond_to :html respond_to :json, :only => :show def show @photo = current_user.find_visible_post_by_id params[:id] # ... respond_with @photo end end
  • 49. Model # app/models/photo.rb (abbreviated) class Photo < Post include MongoMapper::Document require 'carrierwave/orm/mongomapper' mount_uploader :image, ImageUploader key :caption, String key :status_message_id, ObjectId belongs_to :status_message validate :ownership_of_status_message before_destroy :ensure_user_picture end
  • 50. View Rendering photo list
  • 51. HAML View -# app/views/people/show.html.haml (abbr.) .span-15.last %h4 = t('_photos') = render 'photos/index', :photos => @posts -# app/views/photos/_index.html.haml (abbr.) #thumbnails.span-15.last - for photo in photos = link_to photo.url(:thumb_medium), photo_path(photo)
  • 52. Rendered HTML View <div class='span-15 last'> <h4> photos </h4> <div class='span-15 last' id='thumbnails'> <a href="/photos/4d0694d..."><img src="/uploads/images/..." /></a> <a href="/photos/4d06949..."><img src="/uploads/images/..." /></a> <a href="/photos/4d068b2..."><img src="/uploads/images/..." /></a> </div> </div>
  • 53. Rails: Summary • No wasting time deciding where to put something Place for Everything & • Shared conventions get team members up to Conventions speed quickly • No wasted effort getting started Defaults with Choices • Easy to add/change components later • Development: “code and reload” Environments • Test: disposable data • Production: cache and optimize • Mature framework, frequent updates Community • Rich catalog of plugins • Rails programmers are in-demand
  • 54. Dynamic toolkit of the cloud
  • 55. Getting JRuby OS How to get •http://jruby.org/download All •Ruby Version Manager (RVM) http://rvm.beginrescueend.com/ Windows •Installer from http://jruby.org/download Mac OS X •Homebrew - brew install jruby •MacPorts - port install jruby Ubuntu/Debian •apt-get install jruby (may not be up-to-date, may need multiverse) Fedora/RHEL/Centos •yum install jruby (may not be up-to-date) Gentoo •emerge dev-java/jruby (may be old) http://wiki.jruby.org/JRubyDistributions
  • 56. Using JRuby $ jruby script.rb Run a standalone script $ jruby -S gem ... Run Rubygems, IRB, or an installed gem (e.g, rake or rails) $ jruby -J-Xmx1G ... Pass arguments to the JVM $ jruby --help Get help $ jruby --properties
  • 57. Access Java from JRuby require 'java' require 'rubygems' require 'flying_saucer' java_import org.xhtmlrenderer.pdf.ITextRenderer document = <<-HTML <html><body><h1>Hello Flying Saucer!</h1></body></html> HTML File.open("doc.pdf", "wb") do |out| renderer = ITextRenderer.new renderer.set_document_from_string document renderer.layout renderer.create_pdf out.to_outputstream end system("open doc.pdf") Tip: jruby -S gem install flying_saucer to try this example.
  • 58. Access Java from JRuby $ jruby saucer.rb
  • 59. Access Java from JRuby require 'java' Loads Java Integration
  • 60. Access Java from JRuby require 'rubygems' require 'flying_saucer' Loads Flying Saucer classes from Rubygems
  • 61. Access Java from JRuby java_import org.xhtmlrenderer.pdf.ITextRenderer Imports ITextRenderer class
  • 62. Access Java from JRuby Ruby renderer = ITextRenderer.new Java ITextRenderer renderer = new ITextRenderer(); Create new ITextRenderer
  • 63. Access Java from JRuby Ruby renderer.set_document_from_string document Java renderer.setDocumentFromString(document); Set up the document
  • 64. Access Java from JRuby File.open("doc.pdf", "wb") do |out| ... renderer.create_pdf out.to_outputstream end Create PDF with explicit conversion from Ruby IO to Java OutputStream
  • 65. Integrating into Rails Mime::Type.register 'application/pdf', :pdf Register PDF mime type in Rails
  • 66. Integrating into Rails class PhotosController private def pdf_to_string io = StringIO.new content = render_to_string renderer = ITextRenderer.new renderer.set_document_from_string(content) renderer.layout renderer.create_pdf(io.to_outputstream) io.string end end
  • 67. Integrating into Rails class PhotosController def index @photos = Photos.all respond_to do |format| format.html format.pdf do send_data pdf_to_string, :filename => pdf_name + ".pdf", :type => 'application/pdf', :disposition => 'inline' end end end end
  • 68. Integrating into Rails http://example.com/photos HTML view of photo listing http://example.com/photos.pdf Inline PDF of photo listing
  • 69. Rails 3 and JRuby http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done
  • 71. Rails Performance http://github.com/wycats/rails-simple-benches rails-simple N = 10,000 rails-simple N = 10,000 15000 120000 ruby 1.9.2 ruby 1.9.2 12500 jruby-head client 100000 jruby-head client 10000 jruby-head server 80000 jruby-head server 7500 60000 5000 40000 2500 20000 0 0 partial_100 coll_100 uniq_100 diff_100 ad x 1 al 10 10 de e_ rti _ ll_ he at al pa in co er rti pl ov pa m te
  • 72. JRuby Deployment Ruby servers WAR files PaaS WEBrick GlassFish EY AppCloud GF Gem Tomcat AppEngine Trinidad JBoss SteamCannon
  • 73. Warbler INSTALL gem install warbler • Create a Java EE .war file from a Rails application • “Looks like Java” to the ops staff deploy Rails warble app.war to java app appserver
  • 74. JRuby-Rack Servlet Filter /home.jsp: Servlet JSP dispatch pass-thru /home.jsp /home/index: JRuby-Rack 404 RackFilter doFilter On 404: /home/index Rails or any /home/index: Rack-based Rails application Home- Controller
  • 75. Hybrid Rails/Java Webapp ActionDispatch Rails MVC ActionController/ActionView ActiveModel Java JDBC SOAP POJOs DataSource interface
  • 76. Tools http://www.jetbrains.com/ruby/ http://redcareditor.com/ http://netbeans.org/
  • 77. Enterprise Software Evolving and adapting long-running projects with legacy codebases
  • 79. http://www.flickr.com/photos/mgrenner57/263392884/ 1970s early 2000s http://www.flickr.com/photos/gonzalvo/4257293127/
  • 80. http://www.flickr.com/photos/koocheekoo/38407225/ http://www.flickr.com/photos/27649557@N07/5000528445/ passion facade nativity facade scaffolded interior http://www.flickr.com/photos/gpaumier/446059442/ http://www.flickr.com/photos/ilm/12831049/
  • 81. http://en.wikipedia.org/wiki/File:Ryugyong_Hotel_October_2010.jpg 2010 Ryugyuong Hotel, North Korea 2005 http://en.wikipedia.org/wiki/File:Ryugyong_Hotel_-_May_2005.JPG
  • 82. http://en.wikipedia.org/wiki/File:ExteiorShearTruss.jpg seismic retrofit http://en.wikipedia.org/wiki/File:ExtReenfDetail.jpg
  • 83. http://en.wikipedia.org/wiki/File:Szkieleteor_in_krakow.JPG Szkieletor, Kraków, Poland http://www.flickr.com/photos/bazylek/3194294047/
  • 84. Built Environment Metaphor Metaphor Use Ruby, JRuby, and Rails to... • Build a new facade faster with modern technology Sagrada Familia • Scaffold portions of the application during refactoring • Revive a languishing project by putting a new face on it Ryugyong Hotel • Reinforce business rules with a DSL Seismic retrofit • Harden security around an existing application Szkieletor • Find novel uses for otherwise abandoned code
  • 85. JRuby Stories: LinkedIn Signal • High-volume social networking application • http://www.infoq.com/articles/linkedin-scala-jruby-voldemort • http://blog.linkedin.com/2010/09/29/linkedin-signal/
  • 86. JRuby Stories: Tracker • Protecting the world from terrorists! • Export Control workflow system • Used by US State dept. and other countries • JRuby, Rails and legacy Java • http://trackernet.org • Making the World Safe For Democracy • David Bock, Arild Shirazi • http://vimeo.com/16270284
  • 87. JRuby Events • JRubyConf 2009 • free event following RubyConf • ~200 attendees • JRubyConf 2010 • standalone conference • 150 attendees • JRuby meetups in SF Bay Area • http://www.meetup.com/SF-Bay- Area-JRuby-Meetup/
  • 89. JRuby on AppCloud JRuby + AppCloud
  • 90. Resources • Contact me: Nick Sieger – nsieger@engineyard.com • These slides: http://j.mp/ey-jruby-connecting • JRuby.org – http://jruby.org/ • JRubyConf 2010 videos • http://j.mp/jrubyconf-2010-videos • EY Blog: Resources for Getting Started with Ruby on Rails • http://j.mp/ey-getting-started-rails • Rails for Zombies • http://railsforzombies.org/
  • 91. Zero to Rails 3 Virtual Training January 24-27, 2011  http://www.eventbee.com/view/zero-to-rails-3 training@engineyard.com Immediately following (optional): Engine Yard AppCloud Demo with Danish Khan 15-20 minute overview of AppCloud