SlideShare a Scribd company logo
1JRuby in Java ProjectsDenis Lutz
2Motivation: Problem, SolutionJRuby as languageJava and Ruby Integration Ruby CommunityShow Case DemoUsage areas for JRubyAgenda
3Motivation
4Lets redefine our thinkingWhat is our task?What is the shortest path to the solution?Since…Not the solving of complicated tasks is the goal…but solving our task in the easiest possible wayMotivation
5Java has a huge set of toolsJVM scripting languages are present (Groovy)You can find a tool for everythingThe java magazines are writing about scripting languagesTheory
6Projectwide scripting support not the rule, more an exceptionAnt = scripting language =>  XML is our scripting languageIf scripting language integration => Ant / Spring is the environmentAdhoc scripting areas are randomly used by single devsInstead a major scripting support strategy is missingYoung developers face only java or ant Young devs are on their own to find more expressive languagesReal world praxis
7Entering JRuby
8scripting tool as one of main and known toolsscripting language as the surrounding environment and entry point (not Ant)clearly decleared scripting language standarddefinition of taks areas for the scripting languageeasy and powerfull communication with the underlying operating systempowerfull language features instead of XML tools (Ant, Maven)knowledge reuse because of definition of several scripting areas in a projektfrom GUIs and IDEs to automation and console proceduresfrom enterprisy java community to a fun community in rubyGoal
9What is JRubyJRuby = implementation of Ruby in Java
Runs in JVM and integrates perfectly into Java environments
very expressive
mature
huge community powered by the Ruby on Rails framework10Front End (MVC)Build managementTesting, specifically integration testingImport/Export APIsCode generationWe can use JRuby in many project areas
11Facets of JRuby
12Download Jruby at www.jruby.orgExtractAdd to  $PATHTest your installation with “jruby –v” on the consoleCommand execution with“jruby –S ‘command’ ”jruby –S irb        -> Will start the JRuby consoleGet started with JRuby in 3 mins…
13Simple SyntaxEverything is an objectBlocksSelf contained ( contains most useful libs out of the box)Open classesPrinciple of least surpriseMost imressive language features
14Simple object creation
15Create your class and use it, lightweight and easy!
16Everything is an object
17Blocks, the most amazing and powerful feature ever
18Lets call JRuby from Javapublic void callJRuby() {  ScriptEngineManager m = new ScriptEngineManager();  ScriptEngine rubyEngine = m.getEngineByName("jruby");  if (rubyEngine==null)       throw new RuntimeException("Did not find my ruby engine");  ScriptContext context = rubyEngine.getContext();  context.setAttribute("world","Programmierer",ScriptContext.ENGINE_SCOPE);  try{    File f = new File("hello1.rb");     BufferedReader br = new BufferedReader(new FileReader(f));     rubyEngine.eval(br, context); // (1)   } catch (ScriptException e) {   e.printStackTrace();   } catch (FileNotFoundException fnfe) {     System.err.println(fnfe.getMessage());   }}
19require 'java’java_import java.lang.System => Java::JavaLang::System version = System.getProperties["java.runtime.version"] => "1.6.0_17-b04-248-10M3025” import java.util.ArrayListlist = ArrayList.new => #<Java::JavaUtil::ArrayList:0x2bf09a31> ruby-1.8.7-p334 :042 > iterator = list.iterator => #<#<Class:01x41a7c484>:0x367c218e> ruby-1.8.7-p334 :043 > iterator.java_class => class java.util.AbstractList$Itr ruby-1.8.7-p334 :044 > list.get(1)NativeException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0Lets call Java from Jruby und use your legacy systems
20Ruby’s Community
21Very strong community, why?Got powered by Ruby on Rails (MVC Framework)Fun oriented communityMotivated hobby programmers, who can be 9-5 employees ;-)Get into positive cycle of beeing threated well and wanting more rubyGEMS = ruby libraries, created by the communityCommunity
22Endless amounts of gems
23Find most popular gems in one place, rated by the community
24Live Demo: Using a GEM
25we want to communicate with a REST APIshould be usable within a buildor inside a java class of courseShould provide an easy API for our java classThe taskEasiest solution (a base for it) ?
26Choose your gemHTTPartyChoose HTTParty as the gem for REST communication
27Install the GEM
28Write our nice little class
29Use it immidiatelly on the console to play with it
30We knew from one site about the best fitting GEM for our taskWe had no troubles installing itI can try my written code on the consoleit just works, doesn’t matter what you installits my experience after two years using ruby, yours will be the sameWhy was this great?
31Integration with Java
32Yes its right, Rails got over JSF (java standard) in the meanwhileIs this still a new and not known technology for you?Rails (Ruby) popularity
33Yes, possible and widely usedJRuby on Rails Frontend as war file in TomcatRails Front Ends in Java Projects possible everything else is waste of money and developers frustrationNo risk, tell to your java influenced boss: „its just a war file“  No server infrastructure changes neededDeploy a Ruby on Rails Application in a java warjruby -S gem install -y rails warbler$RAILS_APP_ROOT/jruby -S warble war
34Java Build with Rake
35Rake as build tool in Java projectsBasic problem:ANT is accepted, Maven the „new standard“None of them is sufficient for the task we want to doWhy?
36Projectsetup, its in the Wiki, well because Ant cant do it ;-) Folders and File management„if“ – „else“ , can you declare it out of your head now in Ant?  Declare a method in your build? Oh, yea no problem let me just look into Ant APILoading of fixtures, possible with some XML setup againServer startup? I am doing it by hand and each new developer has to learn the specifics Maven „the biggest hype“ that helps me even less then AntProblems with Ant and others…
37Full language power in your build, not XMLWe can still call our old Ant tasksUNIX operations as if we would be on the consoleMethod declarations, as simple as possibleReuse of a language we already usenot learning new XML frameworksWhat we want
38Rake does all you want :project setupmethodsoperating system callsobjects in your buildfile operationsIvy integrationRake is the solution, rubys build tool
39Rake in 3 mins, nothing is easier!
40Call classic and custom Ant tasks from rake if needed
41Operating system communicationFile managementFolder managementTalk to your operating system as from the console
42Some rake possibilities = just full ruby power
43In/Out API for your project
44Its difficult to process files as well as different formats in javaImport or Export is mostly a focused single taskCan be done separated, by one developerNo requirement to do it in javaCustomer data import is a very common and important taskUse JRuby to provide an import / export APIData processing much fasterEasy CSV, Excel, XML processing Generate projects specific formats for importJRuby as your In/Out API of any project
45JRuby as your In/Out API of any project
46(Integration) Testing
47Integration tests are the best candidate to do it with JRubyAbstract, mimal input, very high coverageAre easy to keep out of the java environment systemCan be perfectly done with pure rubyWEBRAT GEM as JRuby LibraryIntegration Testing
48Webrat Example
49GUI Testing APIEvaluates the pure HTML outputNo browser setup or dependency to run your testsWrite your tests fast in ruby Cover the complete application workflow with minimal effortCan be run automatically in backgroud while developingExcellent to give fast feedback about application stabilityWebrat
50Expected Result from Jruby integration
51All mentioned task areas can be done easier in JRubyMore choices of tools, as would it be only with JavaKnowledge reuse in different project areasWork is getting more lightweigtFrom java IDEs to fast editorsPerfect interaction between different parts of the buildExpected result
Ad

More Related Content

What's hot (19)

Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012
Anton Arhipov
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
Matt 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 JVM
Tom Lee
 
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
Anton Arhipov
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
Keith Bennett
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
Laxman Puri
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
Charles Nutter
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
jeresig
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
Hiro Asari
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
Boulder Java User's Group
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
Burke Libbey
 
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
gicappa
 
JVM
JVMJVM
JVM
Murali Pachiyappan
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
chrisriceuk
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
yoavwix
 
Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012Mastering java bytecode with ASM - GeeCON 2012
Mastering java bytecode with ASM - GeeCON 2012
Anton Arhipov
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Mashups with Drupal and QueryPath
Mashups with Drupal and QueryPathMashups with Drupal and QueryPath
Mashups with Drupal and QueryPath
Matt 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 JVM
Tom Lee
 
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
Anton Arhipov
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
Keith Bennett
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
Laxman Puri
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
Charles Nutter
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
jeresig
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
Hiro Asari
 
The Enterprise Strikes Back
The Enterprise Strikes BackThe Enterprise Strikes Back
The Enterprise Strikes Back
Burke Libbey
 
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
gicappa
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Agnieszka Figiel
 
Java bytecode and classes
Java bytecode and classesJava bytecode and classes
Java bytecode and classes
yoavwix
 

Similar to JRuby in Java Projects (20)

From Ant to Rake
From Ant to RakeFrom Ant to Rake
From Ant to Rake
jazzman1980
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
00 intro to java
00 intro to java00 intro to java
00 intro to java
Deia Abdullah
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRuby
Brian Sam-Bodden
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)
mafffffe19
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
PawanMM
 
Java programming Introduction | Java basic architecture
Java programming Introduction | Java basic architectureJava programming Introduction | Java basic architecture
Java programming Introduction | Java basic architecture
shaswinayyan
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
José Maria Silveira Neto
 
Java presentation
Java presentationJava presentation
Java presentation
Karan Sareen
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
Vinit Vyas
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
java new technology
java new technologyjava new technology
java new technology
chavdagirimal
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
Java2020 programming basics and fundamentals
Java2020 programming basics and fundamentalsJava2020 programming basics and fundamentals
Java2020 programming basics and fundamentals
swecsaleem
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?
Charlie Gracie
 
JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?
Charlie Gracie
 
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptxJAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
netaji10700
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Java ppt-class_Introduction_class_Objects.ppt
Java ppt-class_Introduction_class_Objects.pptJava ppt-class_Introduction_class_Objects.ppt
Java ppt-class_Introduction_class_Objects.ppt
VGaneshKarthikeyan
 
From Ant to Rake
From Ant to RakeFrom Ant to Rake
From Ant to Rake
jazzman1980
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRuby
Brian Sam-Bodden
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)
mafffffe19
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
Hitesh-Java
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
PawanMM
 
Java programming Introduction | Java basic architecture
Java programming Introduction | Java basic architectureJava programming Introduction | Java basic architecture
Java programming Introduction | Java basic architecture
shaswinayyan
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
Vinit Vyas
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
Martin Chapman
 
Java2020 programming basics and fundamentals
Java2020 programming basics and fundamentalsJava2020 programming basics and fundamentals
Java2020 programming basics and fundamentals
swecsaleem
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?
Charlie Gracie
 
JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?
Charlie Gracie
 
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptxJAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
JAVA_VR23_OOPS THROUGH JAVA PPT UNIT-1.pptx
netaji10700
 
brief introduction to core java programming.pptx
brief introduction to core java programming.pptxbrief introduction to core java programming.pptx
brief introduction to core java programming.pptx
ansariparveen06
 
Java ppt-class_Introduction_class_Objects.ppt
Java ppt-class_Introduction_class_Objects.pptJava ppt-class_Introduction_class_Objects.ppt
Java ppt-class_Introduction_class_Objects.ppt
VGaneshKarthikeyan
 
Ad

Recently uploaded (20)

AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Ad

JRuby in Java Projects

  • 1. 1JRuby in Java ProjectsDenis Lutz
  • 2. 2Motivation: Problem, SolutionJRuby as languageJava and Ruby Integration Ruby CommunityShow Case DemoUsage areas for JRubyAgenda
  • 4. 4Lets redefine our thinkingWhat is our task?What is the shortest path to the solution?Since…Not the solving of complicated tasks is the goal…but solving our task in the easiest possible wayMotivation
  • 5. 5Java has a huge set of toolsJVM scripting languages are present (Groovy)You can find a tool for everythingThe java magazines are writing about scripting languagesTheory
  • 6. 6Projectwide scripting support not the rule, more an exceptionAnt = scripting language => XML is our scripting languageIf scripting language integration => Ant / Spring is the environmentAdhoc scripting areas are randomly used by single devsInstead a major scripting support strategy is missingYoung developers face only java or ant Young devs are on their own to find more expressive languagesReal world praxis
  • 8. 8scripting tool as one of main and known toolsscripting language as the surrounding environment and entry point (not Ant)clearly decleared scripting language standarddefinition of taks areas for the scripting languageeasy and powerfull communication with the underlying operating systempowerfull language features instead of XML tools (Ant, Maven)knowledge reuse because of definition of several scripting areas in a projektfrom GUIs and IDEs to automation and console proceduresfrom enterprisy java community to a fun community in rubyGoal
  • 9. 9What is JRubyJRuby = implementation of Ruby in Java
  • 10. Runs in JVM and integrates perfectly into Java environments
  • 13. huge community powered by the Ruby on Rails framework10Front End (MVC)Build managementTesting, specifically integration testingImport/Export APIsCode generationWe can use JRuby in many project areas
  • 15. 12Download Jruby at www.jruby.orgExtractAdd to $PATHTest your installation with “jruby –v” on the consoleCommand execution with“jruby –S ‘command’ ”jruby –S irb -> Will start the JRuby consoleGet started with JRuby in 3 mins…
  • 16. 13Simple SyntaxEverything is an objectBlocksSelf contained ( contains most useful libs out of the box)Open classesPrinciple of least surpriseMost imressive language features
  • 18. 15Create your class and use it, lightweight and easy!
  • 20. 17Blocks, the most amazing and powerful feature ever
  • 21. 18Lets call JRuby from Javapublic void callJRuby() { ScriptEngineManager m = new ScriptEngineManager(); ScriptEngine rubyEngine = m.getEngineByName("jruby"); if (rubyEngine==null) throw new RuntimeException("Did not find my ruby engine"); ScriptContext context = rubyEngine.getContext(); context.setAttribute("world","Programmierer",ScriptContext.ENGINE_SCOPE); try{ File f = new File("hello1.rb"); BufferedReader br = new BufferedReader(new FileReader(f)); rubyEngine.eval(br, context); // (1) } catch (ScriptException e) { e.printStackTrace(); } catch (FileNotFoundException fnfe) { System.err.println(fnfe.getMessage()); }}
  • 22. 19require 'java’java_import java.lang.System => Java::JavaLang::System version = System.getProperties["java.runtime.version"] => "1.6.0_17-b04-248-10M3025” import java.util.ArrayListlist = ArrayList.new => #<Java::JavaUtil::ArrayList:0x2bf09a31> ruby-1.8.7-p334 :042 > iterator = list.iterator => #<#<Class:01x41a7c484>:0x367c218e> ruby-1.8.7-p334 :043 > iterator.java_class => class java.util.AbstractList$Itr ruby-1.8.7-p334 :044 > list.get(1)NativeException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0Lets call Java from Jruby und use your legacy systems
  • 24. 21Very strong community, why?Got powered by Ruby on Rails (MVC Framework)Fun oriented communityMotivated hobby programmers, who can be 9-5 employees ;-)Get into positive cycle of beeing threated well and wanting more rubyGEMS = ruby libraries, created by the communityCommunity
  • 26. 23Find most popular gems in one place, rated by the community
  • 28. 25we want to communicate with a REST APIshould be usable within a buildor inside a java class of courseShould provide an easy API for our java classThe taskEasiest solution (a base for it) ?
  • 29. 26Choose your gemHTTPartyChoose HTTParty as the gem for REST communication
  • 31. 28Write our nice little class
  • 32. 29Use it immidiatelly on the console to play with it
  • 33. 30We knew from one site about the best fitting GEM for our taskWe had no troubles installing itI can try my written code on the consoleit just works, doesn’t matter what you installits my experience after two years using ruby, yours will be the sameWhy was this great?
  • 35. 32Yes its right, Rails got over JSF (java standard) in the meanwhileIs this still a new and not known technology for you?Rails (Ruby) popularity
  • 36. 33Yes, possible and widely usedJRuby on Rails Frontend as war file in TomcatRails Front Ends in Java Projects possible everything else is waste of money and developers frustrationNo risk, tell to your java influenced boss: „its just a war file“ No server infrastructure changes neededDeploy a Ruby on Rails Application in a java warjruby -S gem install -y rails warbler$RAILS_APP_ROOT/jruby -S warble war
  • 38. 35Rake as build tool in Java projectsBasic problem:ANT is accepted, Maven the „new standard“None of them is sufficient for the task we want to doWhy?
  • 39. 36Projectsetup, its in the Wiki, well because Ant cant do it ;-) Folders and File management„if“ – „else“ , can you declare it out of your head now in Ant? Declare a method in your build? Oh, yea no problem let me just look into Ant APILoading of fixtures, possible with some XML setup againServer startup? I am doing it by hand and each new developer has to learn the specifics Maven „the biggest hype“ that helps me even less then AntProblems with Ant and others…
  • 40. 37Full language power in your build, not XMLWe can still call our old Ant tasksUNIX operations as if we would be on the consoleMethod declarations, as simple as possibleReuse of a language we already usenot learning new XML frameworksWhat we want
  • 41. 38Rake does all you want :project setupmethodsoperating system callsobjects in your buildfile operationsIvy integrationRake is the solution, rubys build tool
  • 42. 39Rake in 3 mins, nothing is easier!
  • 43. 40Call classic and custom Ant tasks from rake if needed
  • 44. 41Operating system communicationFile managementFolder managementTalk to your operating system as from the console
  • 45. 42Some rake possibilities = just full ruby power
  • 46. 43In/Out API for your project
  • 47. 44Its difficult to process files as well as different formats in javaImport or Export is mostly a focused single taskCan be done separated, by one developerNo requirement to do it in javaCustomer data import is a very common and important taskUse JRuby to provide an import / export APIData processing much fasterEasy CSV, Excel, XML processing Generate projects specific formats for importJRuby as your In/Out API of any project
  • 48. 45JRuby as your In/Out API of any project
  • 50. 47Integration tests are the best candidate to do it with JRubyAbstract, mimal input, very high coverageAre easy to keep out of the java environment systemCan be perfectly done with pure rubyWEBRAT GEM as JRuby LibraryIntegration Testing
  • 52. 49GUI Testing APIEvaluates the pure HTML outputNo browser setup or dependency to run your testsWrite your tests fast in ruby Cover the complete application workflow with minimal effortCan be run automatically in backgroud while developingExcellent to give fast feedback about application stabilityWebrat
  • 53. 50Expected Result from Jruby integration
  • 54. 51All mentioned task areas can be done easier in JRubyMore choices of tools, as would it be only with JavaKnowledge reuse in different project areasWork is getting more lightweigtFrom java IDEs to fast editorsPerfect interaction between different parts of the buildExpected result
  • 55. 52My personal, subjective impressionYou will reach more, having to know lessAchieve more with less work using ruby
  • 56. 53http://www.jruby.org/http://kenai.com/projects/jruby/pages/HomeJruby console with “jruby –S irb”http://www.cygwin.com/ (Unix Console replacement for Windows)EditorsTextmate (MacOs)http://www.e-texteditor.com/ (Windows)IDE’shttp://www.jetbrains.com/ruby/http://www.aptana.com/products/radrails (Eclipse Plugin)http://wiki.netbeans.org/Ruby (Netbeans Ruby Support)Further informations
  • 57. 54Thanks a lot and have fun with JRuby!