SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Bitter Java?
Sweeten with JRuby

   Brian Sam-Bodden
Java Today
Java is a 10+ year old programming language

          Java is the new COBOL

               Java is Dead

              Long live Java!
Java is not going anywhere

Because Java is everywhere!

   But Java is not perfect

and it is adjusting to keep up
Java has its jewels

JDBC, JMS, Servlets

and its blemishes...

   EJB < 3, JSF
But we have a secret weapon...

              On this corner...
  presenting the amazing, highly tuned, multi-
platform computing engine that dominates the
       present and permeates the future


             The JVM
The are more than 200+ languages implementations
                  for the Java VM


The Java VM is like that neighborhood with low taxes
       and good schools... everyone wants in


Regardless of where we go with Java “the language”,
        Java “the platform” is here to stay
Groovy, JRuby and all the new kids on the block are
just new additions to our beloved Swiss army knife
What’s Missing?
Java is solid on the server-side

            Java powers the enterprise

  Web development with Java has not been all that
       successful in the presentation tier

Dynamic languages and frameworks based on dynamic
 languages have proved to be better suited for this
Why Ruby?
Why not?
✓Object-Oriented
     ✓Elegant                        ✓General Purpose


✓ Multi-paradigm
                   Ruby                    ✓   Interpreted

                           is...
    ✓Reflective                             ✓Dynamic

                   ✓   Garbage-collected
Created by Yukihiro “Matz” Matsumoto

Developed in 1993, released in 1995

       Blended parts of his favorite languages:

     Perl, Smalltalk, Sather, Eiffel, CLU, Ada and Lisp

          More popular than Python in Japan
Ruby Ideals:

           Programming should be fun!

            Principle of Least Surprise

“I believe people want to express themselves when
   they program. They don’t want to fight with the
 language. Programming languages must feel natural
                 to programmers.”
                                              Matz
JRuby
A non-Java language for the Java platform

   A Ruby interpreter written in Java

         Started life in 2001

   Current version is 1.0 (1.1b1)

             Open Source
Oh, come on! Grow up!
Ruby libraries from Java (like ActiveRecord)


➡Using Bean Scripting Framework (JDK <= 1.5)

   ➡Using JSR 223 Scripting API (JDK > 1.5)

     Java libraries from Ruby (Swing, SWT)
RubyGems comes pre-installed

               Mongrel supports JRuby

                    Rails just works

No native extensions (unless by native you mean Java ;-)
JRuby does not produce bytecode artifacts for
            the Ruby code (yet!)

     This is key difference with Groovy*

 Corporate backing :-) Sun and Thoughtworks
    have folks working on JRuby full-time
All you need to run JRuby is the Java JDK (=>1.4)
Familiar?




pure Ruby with Java players
Let’s try some interactive JRuby

   Fire up the JRuby console using Java Web Start

http://www.tc.umn.edu/%7Eenebo/webstart/jirb-console/console.jnlp


      Java version of IRB (Interactive RuBy) tool
IRB is the best to get acquainted with Ruby
A Simple
Comparison
Let’s do some file I/O...

First we need a text file
package com.integrallis;
import java.io.BufferedReader;             Let’s open the text file
import java.io.FileReader;
import java.io.IOException;               and print out its contents
public class MyFileReader {                           ...in Java
	   public static void main(String[] args) {
	   	 try {
	   	 	 BufferedReader in = new BufferedReader(new FileReader(quot;read_me.txtquot;));
	   	 	 String str;
	   	 	 while ((str = in.readLine()) != null) {
	   	 	 	 System.out.println(str);
	   	 	 }
	   	 	 in.close();
	   	 } catch (IOException e) {
	   	 	 e.printStackTrace();
	   	 }
	   }
}
Let’s do it the Ruby way!
But wait! This just in...
    ... Ruby encapsulates common behaviors




➡   A one-liner version, yet is readable!
Why?
For Web applications...

                Best of both worlds:

    ➡Dynamic-Framework on the Front End (Rails)
➡Solid Back End battle tested technologies (Spring/EJB3)
Got API-itis?

      Ruby’s ability to create concise DSLs

paired with Java’s richness of APIs and frameworks

   Java APIs are robust, fully-featured, flexible...

          ...which makes them complex

A JRuby DSL can help us in the 80-20 scenarios
Got API-itis? JRuby+SWT
There are JRuby DSLs all ready to use...
                       Today!

         ActiveRecord-JDBC - OR-Wrapping

  Raven - Wrapper for Rake, RubyGems and Maven

            AntBuilder - Wrapper for Ant

              JRake - Wrapper for Rake

JtestR - Test Java code with the best Ruby testing tools
JRuby on Rails
Java & JEE

     the most prevalent language

the most complete enterprise platform

 a rich ecosystem of web frameworks

  a vibrant open source community
Java & JEE

   plagued by mediocre web frameworks

    not well suited for rapid prototyping

in need of a dynamic language web framework

one level of abstraction too low for the web
Who could help Java on the Web Tier?
Ruby on Rails

a revolutionary web framework

   complete MVC solution

       fast prototyping

     killer AJAX support
Ruby on Rails

         a DSL for the web

leading the pack on the web 2.0 front

born from a product, not a committee

  a vibrant open source community
JRuby on Rails

the agility of rails - the scalability of Java

 JRuby likely to surpass Ruby in speed

sneak Ruby and RoR into the enterprise!
JRuby on Rails
JRuby on Rails
JRuby on Rails

       JEE servers are good at scaling up

      no more multi-process management

         use JRuby “multi-VM” support

leverage the maturity of the JVM and JEE servers
JRuby on Rails
 deploy your Rails app as a WAR

leverage JDBC from ActiveRecord
JRuby &
Rapid Spring
Prototyping
JRuby+Spring RAD

      a simple example by the folks at jobster

          use JRuby for rapid prototyping

Spring controller that delegates to a JRuby controller

      JRuby controllers live alongside your JSPs
JRuby+Spring RAD




   Simple JRuby controller
JRuby+Spring RAD




JSP view provides input to the Ruby controller
JRuby+Spring RAD




JSP view provides input to the Ruby controller
JRuby+Spring RAD

   this experimental library supports:

✓access to Spring beans from JRuby code
    ✓ access to Hibernate queries
JRuby on
Springy Rails
JRoR on Spring
         Chris Nelson’s work


            ✓use rails-integration plugin
✓ expose WebApplicationContext in a RoR controller
      ✓include Spring - Spring plugin for JRuby
JRoR on Spring
✓install goldspike rails-integration plugin on you JRoR app


 ✓ rake war:standalone:create to package a WAR with:
       ➡Your RoR app
        ➡JRuby and Rails libraries
JRoR on Spring
rake war:standalone:create in action:
JRoR on Spring
generated WARs work on many servers:


    ✓Tomcat        ✓Glassfish
     ✓Jetty          ✓JBoss
JRoR on Spring
✓   add Chris’ Spring module:
JRoR on Spring

✓ Expand the generated   WAR

✓Add Spring application
   ➡ Application Code
   ➡ Libraries (Jars)
   ➡ Config Files
JRoR on Spring
✓   access your Spring beans from a RoR controller
JRoR on Spring

   ✓add a new face to your Spring applications
 ✓   leverage thousands of open source projects

✓leverage the good parts of JEE like JDBC and JMS
Resources
                               JRuby
                            www.jruby.org
                  rubyforge.org/projects/jruby-extras


                  JRuby Rails Integration
         www.headius.com/jrubywiki/index.php/Rails_Integration
headius.blogspot.com/2006/11/advanced-rails-deployment-with-jruby.html


         RAD Spring Prototyping with JRuby
            thebogles.com/blog/projects/ruby-on-spring/
 www.botspiritcompany.com/src/springruby/example_ruby_spring.html


                    Chris Nelson’s Work
         mysterycoder.blogspot.com/2007/06/spring-jruby.html
        mysterycoder.blogspot.com/2007/06/include-spring.html
www.integrallis.com
Bitter Java, Sweeten with JRuby

Weitere ähnliche Inhalte

Was ist angesagt?

Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails PresentationJoost Hietbrink
 
Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Rubydeimos
 
From java-to-ruby-book-summary
From java-to-ruby-book-summaryFrom java-to-ruby-book-summary
From java-to-ruby-book-summary120bi
 
Ruby - a tester's best friend
Ruby - a tester's best friendRuby - a tester's best friend
Ruby - a tester's best friendPeter Lind
 
Merb For The Enterprise
Merb For The EnterpriseMerb For The Enterprise
Merb For The EnterpriseMatt Aimonetti
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)scandiweb
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Thomas Lundström
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
itft-Java evolution
itft-Java evolutionitft-Java evolution
itft-Java evolutionAtul Sehdev
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails PresentationChanHan Hy
 
JRuby and Google App Engine
JRuby and Google App EngineJRuby and Google App Engine
JRuby and Google App Enginejoshsmoore
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projectsjazzman1980
 
O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3Hugo Baraúna
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Coursepeter_marklund
 
Beginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_cccBeginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_cccKazuhiro Sera
 

Was ist angesagt? (20)

Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Ruby
 
From java-to-ruby-book-summary
From java-to-ruby-book-summaryFrom java-to-ruby-book-summary
From java-to-ruby-book-summary
 
Ruby - a tester's best friend
Ruby - a tester's best friendRuby - a tester's best friend
Ruby - a tester's best friend
 
Merb For The Enterprise
Merb For The EnterpriseMerb For The Enterprise
Merb For The Enterprise
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
itft-Java evolution
itft-Java evolutionitft-Java evolution
itft-Java evolution
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
JRuby and Google App Engine
JRuby and Google App EngineJRuby and Google App Engine
JRuby and Google App Engine
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projects
 
Polyglot OSGi
Polyglot OSGiPolyglot OSGi
Polyglot OSGi
 
Project Zero JavaOne 2008
Project Zero JavaOne 2008Project Zero JavaOne 2008
Project Zero JavaOne 2008
 
O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
Introduction to Core Java Programming
Introduction to Core Java ProgrammingIntroduction to Core Java Programming
Introduction to Core Java Programming
 
Project Zero Php Quebec
Project Zero Php QuebecProject Zero Php Quebec
Project Zero Php Quebec
 
Beginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_cccBeginning Scala with Skinny Framework #jjug_ccc
Beginning Scala with Skinny Framework #jjug_ccc
 

Andere mochten auch

JRuby on Rails
JRuby on RailsJRuby on Rails
JRuby on RailsFabio Kung
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterpriseJerry Gulla
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microserviceGiulio De Donato
 
Golang server design pattern
Golang server design patternGolang server design pattern
Golang server design pattern理 傅
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Evan Lin
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 

Andere mochten auch (7)

JRuby: The Hard Parts
JRuby: The Hard PartsJRuby: The Hard Parts
JRuby: The Hard Parts
 
JRuby on Rails
JRuby on RailsJRuby on Rails
JRuby on Rails
 
JRuby in the enterprise
JRuby in the enterpriseJRuby in the enterprise
JRuby in the enterprise
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
 
Golang server design pattern
Golang server design patternGolang server design pattern
Golang server design pattern
 
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 

Ähnlich wie Bitter Java, Sweeten with JRuby

Rails On Spring
Rails On SpringRails On Spring
Rails On Springswamy g
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyelliando dias
 
JRuby in a Java World
JRuby in a Java WorldJRuby in a Java World
JRuby in a Java WorldMark Menard
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVMelliando dias
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Katy Slemon
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0Jan Sifra
 
JRuby - Java version of Ruby
JRuby - Java version of RubyJRuby - Java version of Ruby
JRuby - Java version of RubyUday Bhaskar
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?Orest Ivasiv
 
IronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET PlatformIronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET PlatformAndre John Cruz
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivationjistr
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of javaCIB Egypt
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 

Ähnlich wie Bitter Java, Sweeten with JRuby (20)

Rails On Spring
Rails On SpringRails On Spring
Rails On Spring
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
 
Practical JRuby
Practical JRubyPractical JRuby
Practical JRuby
 
JRuby in a Java World
JRuby in a Java WorldJRuby in a Java World
JRuby in a Java World
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
 
JRuby Basics
JRuby BasicsJRuby Basics
JRuby Basics
 
Why Java
Why JavaWhy Java
Why Java
 
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
Ruby vs Java: Comparing Two Popular Programming Languages For Developing Ente...
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
JRuby - Enterprise 2.0
JRuby - Enterprise 2.0JRuby - Enterprise 2.0
JRuby - Enterprise 2.0
 
First Day With J Ruby
First Day With J RubyFirst Day With J Ruby
First Day With J Ruby
 
JRuby - Java version of Ruby
JRuby - Java version of RubyJRuby - Java version of Ruby
JRuby - Java version of Ruby
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?
 
IronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET PlatformIronRuby: Ruby on the .NET Platform
IronRuby: Ruby on the .NET Platform
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Ruby and Rails short motivation
Ruby and Rails short motivationRuby and Rails short motivation
Ruby and Rails short motivation
 
Athens Ruby Meetup #3: IronRuby
Athens Ruby Meetup #3: IronRubyAthens Ruby Meetup #3: IronRuby
Athens Ruby Meetup #3: IronRuby
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of java
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
 

Mehr von Brian Sam-Bodden

Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBrian Sam-Bodden
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Brian Sam-Bodden
 
Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Brian Sam-Bodden
 
RailsConf 2013: RubyMotion
RailsConf 2013: RubyMotionRailsConf 2013: RubyMotion
RailsConf 2013: RubyMotionBrian Sam-Bodden
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Brian Sam-Bodden
 
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and Mustache
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and MustacheRoad to mobile w/ Sinatra, jQuery Mobile, Spine.js and Mustache
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and MustacheBrian Sam-Bodden
 
Trellis Framework At RubyWebConf
Trellis Framework At RubyWebConfTrellis Framework At RubyWebConf
Trellis Framework At RubyWebConfBrian Sam-Bodden
 

Mehr von Brian Sam-Bodden (10)

Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
 
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
Server-Side Push: Comet, Web Sockets come of age (OSCON 2013)
 
Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008Ruby Metaprogramming - OSCON 2008
Ruby Metaprogramming - OSCON 2008
 
RailsConf 2013: RubyMotion
RailsConf 2013: RubyMotionRailsConf 2013: RubyMotion
RailsConf 2013: RubyMotion
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and Mustache
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and MustacheRoad to mobile w/ Sinatra, jQuery Mobile, Spine.js and Mustache
Road to mobile w/ Sinatra, jQuery Mobile, Spine.js and Mustache
 
Trellis Framework At RubyWebConf
Trellis Framework At RubyWebConfTrellis Framework At RubyWebConf
Trellis Framework At RubyWebConf
 
Integrallis groovy-cloud
Integrallis groovy-cloudIntegrallis groovy-cloud
Integrallis groovy-cloud
 
Ferret
FerretFerret
Ferret
 
Ruby Metaprogramming 08
Ruby Metaprogramming 08Ruby Metaprogramming 08
Ruby Metaprogramming 08
 

Kürzlich hochgeladen

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Bitter Java, Sweeten with JRuby

  • 1. Bitter Java? Sweeten with JRuby Brian Sam-Bodden
  • 3. Java is a 10+ year old programming language Java is the new COBOL Java is Dead Long live Java!
  • 4. Java is not going anywhere Because Java is everywhere! But Java is not perfect and it is adjusting to keep up
  • 5. Java has its jewels JDBC, JMS, Servlets and its blemishes... EJB < 3, JSF
  • 6. But we have a secret weapon... On this corner... presenting the amazing, highly tuned, multi- platform computing engine that dominates the present and permeates the future The JVM
  • 7. The are more than 200+ languages implementations for the Java VM The Java VM is like that neighborhood with low taxes and good schools... everyone wants in Regardless of where we go with Java “the language”, Java “the platform” is here to stay
  • 8. Groovy, JRuby and all the new kids on the block are just new additions to our beloved Swiss army knife
  • 10. Java is solid on the server-side Java powers the enterprise Web development with Java has not been all that successful in the presentation tier Dynamic languages and frameworks based on dynamic languages have proved to be better suited for this
  • 13. ✓Object-Oriented ✓Elegant ✓General Purpose ✓ Multi-paradigm Ruby ✓ Interpreted is... ✓Reflective ✓Dynamic ✓ Garbage-collected
  • 14. Created by Yukihiro “Matz” Matsumoto Developed in 1993, released in 1995 Blended parts of his favorite languages: Perl, Smalltalk, Sather, Eiffel, CLU, Ada and Lisp More popular than Python in Japan
  • 15. Ruby Ideals: Programming should be fun! Principle of Least Surprise “I believe people want to express themselves when they program. They don’t want to fight with the language. Programming languages must feel natural to programmers.” Matz
  • 16. JRuby
  • 17. A non-Java language for the Java platform A Ruby interpreter written in Java Started life in 2001 Current version is 1.0 (1.1b1) Open Source
  • 18. Oh, come on! Grow up!
  • 19. Ruby libraries from Java (like ActiveRecord) ➡Using Bean Scripting Framework (JDK <= 1.5) ➡Using JSR 223 Scripting API (JDK > 1.5) Java libraries from Ruby (Swing, SWT)
  • 20. RubyGems comes pre-installed Mongrel supports JRuby Rails just works No native extensions (unless by native you mean Java ;-)
  • 21. JRuby does not produce bytecode artifacts for the Ruby code (yet!) This is key difference with Groovy* Corporate backing :-) Sun and Thoughtworks have folks working on JRuby full-time
  • 22. All you need to run JRuby is the Java JDK (=>1.4)
  • 24. Let’s try some interactive JRuby Fire up the JRuby console using Java Web Start http://www.tc.umn.edu/%7Eenebo/webstart/jirb-console/console.jnlp Java version of IRB (Interactive RuBy) tool
  • 25. IRB is the best to get acquainted with Ruby
  • 27. Let’s do some file I/O... First we need a text file
  • 28. package com.integrallis; import java.io.BufferedReader; Let’s open the text file import java.io.FileReader; import java.io.IOException; and print out its contents public class MyFileReader { ...in Java public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new FileReader(quot;read_me.txtquot;)); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } catch (IOException e) { e.printStackTrace(); } } }
  • 29. Let’s do it the Ruby way!
  • 30. But wait! This just in... ... Ruby encapsulates common behaviors ➡ A one-liner version, yet is readable!
  • 31. Why?
  • 32. For Web applications... Best of both worlds: ➡Dynamic-Framework on the Front End (Rails) ➡Solid Back End battle tested technologies (Spring/EJB3)
  • 33. Got API-itis? Ruby’s ability to create concise DSLs paired with Java’s richness of APIs and frameworks Java APIs are robust, fully-featured, flexible... ...which makes them complex A JRuby DSL can help us in the 80-20 scenarios
  • 35. There are JRuby DSLs all ready to use... Today! ActiveRecord-JDBC - OR-Wrapping Raven - Wrapper for Rake, RubyGems and Maven AntBuilder - Wrapper for Ant JRake - Wrapper for Rake JtestR - Test Java code with the best Ruby testing tools
  • 37. Java & JEE the most prevalent language the most complete enterprise platform a rich ecosystem of web frameworks a vibrant open source community
  • 38. Java & JEE plagued by mediocre web frameworks not well suited for rapid prototyping in need of a dynamic language web framework one level of abstraction too low for the web
  • 39. Who could help Java on the Web Tier?
  • 40. Ruby on Rails a revolutionary web framework complete MVC solution fast prototyping killer AJAX support
  • 41. Ruby on Rails a DSL for the web leading the pack on the web 2.0 front born from a product, not a committee a vibrant open source community
  • 42. JRuby on Rails the agility of rails - the scalability of Java JRuby likely to surpass Ruby in speed sneak Ruby and RoR into the enterprise!
  • 45. JRuby on Rails JEE servers are good at scaling up no more multi-process management use JRuby “multi-VM” support leverage the maturity of the JVM and JEE servers
  • 46. JRuby on Rails deploy your Rails app as a WAR leverage JDBC from ActiveRecord
  • 48. JRuby+Spring RAD a simple example by the folks at jobster use JRuby for rapid prototyping Spring controller that delegates to a JRuby controller JRuby controllers live alongside your JSPs
  • 49. JRuby+Spring RAD Simple JRuby controller
  • 50. JRuby+Spring RAD JSP view provides input to the Ruby controller
  • 51. JRuby+Spring RAD JSP view provides input to the Ruby controller
  • 52. JRuby+Spring RAD this experimental library supports: ✓access to Spring beans from JRuby code ✓ access to Hibernate queries
  • 54. JRoR on Spring Chris Nelson’s work ✓use rails-integration plugin ✓ expose WebApplicationContext in a RoR controller ✓include Spring - Spring plugin for JRuby
  • 55. JRoR on Spring ✓install goldspike rails-integration plugin on you JRoR app ✓ rake war:standalone:create to package a WAR with: ➡Your RoR app ➡JRuby and Rails libraries
  • 56. JRoR on Spring rake war:standalone:create in action:
  • 57. JRoR on Spring generated WARs work on many servers: ✓Tomcat ✓Glassfish ✓Jetty ✓JBoss
  • 58. JRoR on Spring ✓ add Chris’ Spring module:
  • 59. JRoR on Spring ✓ Expand the generated WAR ✓Add Spring application ➡ Application Code ➡ Libraries (Jars) ➡ Config Files
  • 60. JRoR on Spring ✓ access your Spring beans from a RoR controller
  • 61. JRoR on Spring ✓add a new face to your Spring applications ✓ leverage thousands of open source projects ✓leverage the good parts of JEE like JDBC and JMS
  • 62. Resources JRuby www.jruby.org rubyforge.org/projects/jruby-extras JRuby Rails Integration www.headius.com/jrubywiki/index.php/Rails_Integration headius.blogspot.com/2006/11/advanced-rails-deployment-with-jruby.html RAD Spring Prototyping with JRuby thebogles.com/blog/projects/ruby-on-spring/ www.botspiritcompany.com/src/springruby/example_ruby_spring.html Chris Nelson’s Work mysterycoder.blogspot.com/2007/06/spring-jruby.html mysterycoder.blogspot.com/2007/06/include-spring.html