Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JRuby - Java version of Ruby

5,494 views

Published on

Presentation at Olive on Ruby and JRuby... Demo covers JRuby on Rails using Netbeans.

Published in: Technology
  • Be the first to comment

JRuby - Java version of Ruby

  1. 1. JRuby: The power of Java and Ruby - by Uday Bhaskar Sr., Java Programmer Olive Technology uday@olivetech.com http://udaiibhaskar.blogspot.com
  2. 2. JRuby: The power of Java and Ruby Agenda Introduction to Ruby What is JRuby JRuby on Rails JRuby on Netbeans Where To Go
  3. 3. JRuby: The power of Java and Ruby Introduction to Ruby • Created by Yukihiro “Matz” Matsumoto >Started around 1993, about the same time as Java • What is a scripting language? >No compilation unit puts “Hello world” >Specialized syntax subject.gsub(/before/, quot;afterquot;) >Maybe dynamic typing /duck typing • Design to put the “fun” back into programming
  4. 4. JRuby: The power of Java and Ruby A Typical Ruby Class class Person attr_accessor :fname, :lname def initialize(fname, lname) @fname = fname @lname = lname end def to_s @lname + quot;, quot; + @fname end end
  5. 5. JRuby: The power of Java and Ruby What is Ruby on Rails • Main web framework for Ruby • Scaffolding • Metaprogramming • Convention over configuration • Web development that doesn’t hurt • High productivity >Less code to write >No deployment >Easy to learn
  6. 6. JRuby: The power of Java and Ruby Comparison of Rails and Struts Stack • Tomcat servlet container • Struts Web application framework • Hibernate persistence framework
  7. 7. JRuby: The power of Java and Ruby Ruby/Java • Ruby language is different from Java • Ruby platform is different from Java • How can Java developers benefit?
  8. 8. JRuby: The power of Java and Ruby What is JRuby? • Implementation of Ruby written in Java • Compatible with Ruby 1.8.6 http://jruby.codehaus.org/ • Enables use of Java code in Ruby • Easier deployment • More libraries • More platforms, OpenSource • “Itʼs just Ruby”
  9. 9. JRuby: The power of Java and Ruby JRuby Demo Java: VoiceManager vm = VoiceManager.getInstance(); Voice voice = vm.getVoice(quot;kevin16quot;); voice.allocate(); voice.speak(jTextArea1.getText()); voice.deallocate(); Ruby: require 'java' vm = com.sun.speech.freetts.VoiceManager.getInstance() voice = vm.getVoice(quot;kevin16quot;) voice.allocate() voice.speak(quot;Calling Java code from Rubyquot;) voice.deallocate()
  10. 10. JRuby: The power of Java and Ruby JRuby/Ruby on Rails Demo I am using “Netbeans IDE” for this Demo
  11. 11. JRuby: The power of Java and Ruby Questions “Good Question!” means I don’t have an answer :-)
  12. 12. JRuby: The power of Java and Ruby Where to go for Ruby information • Online material: • http://jruby.codehaus.org/ • http://rubyonrails.org/ • Rails screencast(s) • Planet Ruby on Rails
  13. 13. Thank You - by Uday Bhaskar Sr., Java Programmer Olive InfoServices uday@olivetech.com http://udaiibhaskar.blogspot.com

×