My goals have been:
- focusing on several project areas, where you can use jruby successfully
- share the experience that I made using ruby in the last years
- proove that things can be done easier as they are done in typical java projects
4. 4 Lets redefine our thinking What 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 way Motivation
5. 5 Java has a huge set of tools JVM scripting languages are present (Groovy) You can find a tool for everything The java magazines are writing about scripting languages Theory
6. 6 Projectwide scripting support not the rule, more an exception Ant = scripting language => XML is our scripting language If scripting language integration => Ant / Spring is the environment Adhoc scripting areas are randomly used by single devs Instead a major scripting support strategy is missing Young developers face only java or ant Young devs are on their own to find more expressive languages Real world praxis
8. 8 scripting tool as one of main and known tools scripting language as the surrounding environment and entry point (not Ant) clearly decleared scripting language standard definition of taks areas for the scripting language easy and powerfull communication with the underlying operating system powerfull language features instead of XML tools (Ant, Maven) knowledge reuse because of definition of several scripting areas in a projekt from GUIs and IDEs to automation and console procedures from enterprisy java community to a fun community in ruby Goal
9.
10. Runs in JVM and integrates perfectly into Java environments
15. 12 Download Jruby at www.jruby.org Extract Add to $PATH Test your installation with “jruby –v” on the console Command execution with “jruby –S ‘command’ ” jruby –S irb -> Will start the JRuby console Get started with JRuby in 3 mins…
16. 13 Simple Syntax Everything is an object Blocks Self contained ( contains most useful libs out of the box) Open classes Principle of least surprise Most imressive language features
24. 21 Very strong community, why? Got powered by Ruby on Rails (MVC Framework) Fun oriented community Motivated hobby programmers, who can be 9-5 employees ;-) Get into positive cycle of beeing threated well and wanting more ruby GEMS = ruby libraries, created by the community Community
28. 25 we want to communicate with a REST API should be usable within a build or inside a java class of course Should provide an easy API for our java class The task Easiest solution (a base for it) ?
29. 26 Choose your gem HTTParty Choose HTTParty as the gem for REST communication
32. 29 Use it immidiatelly on the console to play with it
33. 30 We knew from one site about the best fitting GEM for our task We had no troubles installing it I can try my written code on the console it just works, doesn’t matter what you install its my experience after two years using ruby, yours will be the same Why was this great?
35. 32 Yes its right, Rails got over JSF (java standard) in the meanwhile Is this still a new and not known technology for you? Rails (Ruby) popularity
36. 33 Yes, possible and widely used JRuby on Rails Frontend as war file in Tomcat Rails Front Ends in Java Projects possible everything else is waste of money and developers frustration No risk, tell to your java influenced boss: „its just a war file“ No server infrastructure changes needed Deploy a Ruby on Rails Application in a java war jruby -S gem install -y rails warbler $RAILS_APP_ROOT/jruby -S warble war
38. 35 Rake as build tool in Java projects Basic problem: ANT is accepted, Maven the „new standard“ None of them is sufficient for the task we want to do Why?
39. 36 Projectsetup, 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 API Loading of fixtures, possible with some XML setup again Server 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 Ant Problems with Ant and others…
40. 37 Full language power in your build, not XML We can still call our old Ant tasks UNIX operations as if we would be on the console Method declarations, as simple as possible Reuse of a language we already use not learning new XML frameworks What we want
41. 38 Rake does all you want : project setup methods operating system calls objects in your build file operations Ivy integration Rake is the solution, rubys build tool
47. 44 Its difficult to process files as well as different formats in java Import or Export is mostly a focused single task Can be done separated, by one developer No requirement to do it in java Customer data import is a very common and important task Use JRuby to provide an import / export API Data processing much faster Easy CSV, Excel, XML processing Generate projects specific formats for import JRuby as your In/Out API of any project
50. 47 Integration tests are the best candidate to do it with JRuby Abstract, mimal input, very high coverage Are easy to keep out of the java environment system Can be perfectly done with pure ruby WEBRAT GEM as JRuby Library Integration Testing
52. 49 GUI Testing API Evaluates the pure HTML output No browser setup or dependency to run your tests Write your tests fast in ruby Cover the complete application workflow with minimal effort Can be run automatically in backgroud while developing Excellent to give fast feedback about application stability Webrat
54. 51 All mentioned task areas can be done easier in JRuby More choices of tools, as would it be only with Java Knowledge reuse in different project areas Work is getting more lightweigt From java IDEs to fast editors Perfect interaction between different parts of the build Expected result
55. 52 My personal, subjective impression You will reach more, having to know less Achieve more with less work using ruby